1
- " use client" ;
1
+ ' use client'
2
2
3
- import clsx from " clsx" ;
4
- import React from " react" ;
5
- import hljs from " highlight.js" ;
6
- import { Fonts } from " @/app/styles" ;
7
- import { Account , Background , Nav , Snippet } from " @/app/ui" ;
8
- import { Constants , exportImage } from " @/app/utils" ;
9
- import { CodeSettings , ContainerSettings , ExportSettings } from " @/app/types" ;
3
+ import clsx from ' clsx'
4
+ import React from ' react'
5
+ import hljs from ' highlight.js'
6
+ import { Fonts } from ' @/app/styles'
7
+ import { Account , Background , Nav , Snippet } from ' @/app/ui'
8
+ import { Constants , exportImage } from ' @/app/utils'
9
+ import { CodeSettings , ContainerSettings , ExportSettings } from ' @/app/types'
10
10
11
11
const Home = ( ) => {
12
12
// Target element
13
- const target = React . useRef ( null ) ;
13
+ const target = React . useRef ( null )
14
14
15
15
// Container Settings
16
16
const [ container , setContainer ] = React . useState < ContainerSettings > ( {
17
17
theme : true ,
18
- size : " auto" ,
19
- type : " linear" ,
20
- padding : " 64px" ,
18
+ size : ' auto' ,
19
+ type : ' linear' ,
20
+ padding : ' 64px' ,
21
21
isGradient : true ,
22
- direction : " top-right" ,
22
+ direction : ' top-right' ,
23
23
color : Constants . colors [ 0 ] ,
24
24
buttons : { style : true , position : true } ,
25
- } ) ;
25
+ } )
26
26
27
27
// Export settings
28
28
const [ exportSettings , setExport ] = React . useState < ExportSettings > ( {
29
29
quality : 1 ,
30
- format : " png" ,
31
- } ) ;
30
+ format : ' png' ,
31
+ } )
32
32
33
33
// Code Settings
34
34
const [ code , setCode ] = React . useState < CodeSettings > ( {
35
- font : " JetBrains Mono" ,
36
- highlight : " github-dark" ,
35
+ font : ' JetBrains Mono' ,
36
+ highlight : ' github-dark' ,
37
37
displayLineNumbers : true ,
38
38
tab : {
39
- name : " Untitled" ,
40
- content : " Type your code here." ,
41
- language : " plaintext" ,
39
+ name : ' Untitled' ,
40
+ content : ' Type your code here.' ,
41
+ language : ' plaintext' ,
42
42
} ,
43
- } ) ;
43
+ } )
44
44
45
45
// Author
46
46
const [ author , setAuthor ] = React . useState ( {
47
47
isVisible : false ,
48
- name : " Your Name" ,
49
- username : " github.com/username" ,
50
- } ) ;
48
+ name : ' Your Name' ,
49
+ username : ' github.com/username' ,
50
+ } )
51
51
52
52
React . useEffect (
53
53
( ) =>
@@ -59,18 +59,18 @@ const Home = () => {
59
59
} ) ,
60
60
// eslint-disable-next-line react-hooks/exhaustive-deps
61
61
[ ] ,
62
- ) ;
62
+ )
63
63
64
64
React . useEffect ( ( ) => {
65
65
// Remove attribute to re-highlight code
66
- document . getElementById ( " code" ) ?. removeAttribute ( " data-highlighted" ) ;
66
+ document . getElementById ( ' code' ) ?. removeAttribute ( ' data-highlighted' )
67
67
68
68
// Highlight code
69
- hljs . highlightAll ( ) ;
70
- } , [ code ] ) ;
69
+ hljs . highlightAll ( )
70
+ } , [ code ] )
71
71
72
72
return (
73
- < div className = { clsx ( { dark : container . theme } , " block h-screen w-screen" ) } >
73
+ < div className = { clsx ( { dark : container . theme } , ' block h-screen w-screen' ) } >
74
74
< link
75
75
rel = "stylesheet"
76
76
href = "https://cdn.jsdelivr.net/npm/bootstrap-icons@latest/font/bootstrap-icons.min.css"
@@ -107,56 +107,56 @@ const Home = () => {
107
107
< div className = { `relative h-fit w-fit` } >
108
108
< div
109
109
ref = { target }
110
- className = { clsx ( " p-1" , Fonts [ code . font ] . className ) }
110
+ className = { clsx ( ' p-1' , Fonts [ code . font ] . className ) }
111
111
>
112
112
< section
113
113
style = { Constants . sizes [ container . size ] }
114
114
className = { clsx (
115
- " relative flex h-full w-full flex-col items-center justify-center overflow-auto rounded-lg shadow-xl" ,
115
+ ' relative flex h-full w-full flex-col items-center justify-center overflow-auto rounded-lg shadow-xl' ,
116
116
container . color ,
117
117
{
118
- " p-4" : container . padding === " 16px" ,
119
- " p-8" : container . padding === " 32px" ,
120
- " p-16" : container . padding === " 64px" ,
121
- " p-32" : container . padding === " 128px" ,
118
+ ' p-4' : container . padding === ' 16px' ,
119
+ ' p-8' : container . padding === ' 32px' ,
120
+ ' p-16' : container . padding === ' 64px' ,
121
+ ' p-32' : container . padding === ' 128px' ,
122
122
} ,
123
123
{
124
- " bg-gradient-to-t" :
124
+ ' bg-gradient-to-t' :
125
125
container . isGradient &&
126
- container . type === " linear" &&
127
- container . direction === " top" ,
128
- " bg-gradient-to-tr" :
126
+ container . type === ' linear' &&
127
+ container . direction === ' top' ,
128
+ ' bg-gradient-to-tr' :
129
129
container . isGradient &&
130
- container . type === " linear" &&
131
- container . direction === " top-right" ,
132
- " bg-gradient-to-r" :
130
+ container . type === ' linear' &&
131
+ container . direction === ' top-right' ,
132
+ ' bg-gradient-to-r' :
133
133
container . isGradient &&
134
- container . type === " linear" &&
135
- container . direction === " right" ,
136
- " bg-gradient-to-br" :
134
+ container . type === ' linear' &&
135
+ container . direction === ' right' ,
136
+ ' bg-gradient-to-br' :
137
137
container . isGradient &&
138
- container . type === " linear" &&
139
- container . direction === " bottom-right" ,
140
- " bg-gradient-to-b" :
138
+ container . type === ' linear' &&
139
+ container . direction === ' bottom-right' ,
140
+ ' bg-gradient-to-b' :
141
141
container . isGradient &&
142
- container . type === " linear" &&
143
- container . direction === " bottom" ,
144
- " bg-gradient-to-bl" :
142
+ container . type === ' linear' &&
143
+ container . direction === ' bottom' ,
144
+ ' bg-gradient-to-bl' :
145
145
container . isGradient &&
146
- container . type === " linear" &&
147
- container . direction === " bottom-left" ,
148
- " bg-gradient-to-l" :
146
+ container . type === ' linear' &&
147
+ container . direction === ' bottom-left' ,
148
+ ' bg-gradient-to-l' :
149
149
container . isGradient &&
150
- container . type === " linear" &&
151
- container . direction === " left" ,
152
- " bg-gradient-to-tl" :
150
+ container . type === ' linear' &&
151
+ container . direction === ' left' ,
152
+ ' bg-gradient-to-tl' :
153
153
container . isGradient &&
154
- container . type === " linear" &&
155
- container . direction === " top-left" ,
156
- " bg-gradient-conic" :
157
- container . isGradient && container . type === " conic" ,
158
- " bg-gradient-radial" :
159
- container . isGradient && container . type === " radial" ,
154
+ container . type === ' linear' &&
155
+ container . direction === ' top-left' ,
156
+ ' bg-gradient-conic' :
157
+ container . isGradient && container . type === ' conic' ,
158
+ ' bg-gradient-radial' :
159
+ container . isGradient && container . type === ' radial' ,
160
160
} ,
161
161
) }
162
162
>
@@ -184,7 +184,7 @@ const Home = () => {
184
184
</ main >
185
185
</ div >
186
186
</ div >
187
- ) ;
188
- } ;
187
+ )
188
+ }
189
189
190
- export default Home ;
190
+ export default Home
0 commit comments