forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
48 lines (43 loc) · 867 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { css } from 'cssed/macro'
import Head from 'next/head'
import { useState } from 'react'
import { dark, light } from '../lib/theme'
const styles = css`
.box {
height: 200px;
width: 200px;
margin: 0 auto;
margin-top: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.dark {
background-color: ${dark};
}
.dark::before {
content: '🌚';
}
.light {
background-color: ${light};
}
.light::before {
content: '🌞';
}
`
export default function Home() {
const [isDark, setDark] = useState(false)
return (
<>
<Head>
<title>With cssed</title>
</Head>
<div
onClick={() => setDark((prevState) => !prevState)}
className={styles.box + ' ' + (isDark ? styles.dark : styles.light)}
>
Cssed demo
</div>
</>
)
}