-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
97 lines (90 loc) · 2.24 KB
/
App.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import React from 'react';
import { createRoot } from 'react-dom/client';
import { createThemeSwitcher, ThemeProvider, useTheme } from './src/theme'
import { Tag, Transition } from './src';
const useThemeSwitcher = createThemeSwitcher("light")
const ThemeBox = () => {
const themeSwitcher = useThemeSwitcher()
return (
<button
onClick={() => {
themeSwitcher.change(themeSwitcher.name === 'light' ? "dark" : "light")
}}
>
change
</button>
)
}
const Trans = () => {
const theme = useTheme()
const [v, setV] = React.useState<any>('zoom')
const [open, setOpen] = React.useState(true)
return (
<Tag>
<button onClick={() => setOpen(!open)}>Click</button>
<button onClick={() => setV(v === 'zoom' ? { from: {}, to: { transform: "scale(.5)" } } : "zoom")}>change</button>
<Transition open={open} variant="fade" >
<Tag
component="div"
width={300}
bgcolor="green"
radius={2}
p={2}
>
<Transition open={open} variant={v} >
<Tag
component="div"
width={100}
bgcolor="red"
radius={2}
px={2}
>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
</Tag>
</Transition>
</Tag>
</Transition>
</Tag>
)
}
const App = () => {
return (
<ThemeProvider theme="light">
<Tag
flexBox
flexRow
flexWrap="wrap"
gap={1}
p={2}
>
<Trans />
{
Array.from({ length: 1 }).map((_, i) => (
<Tag
key={i}
hover={{
background: 'green'
}}
id="asdasd"
width={100}
height={100}
background='red'
radius={2}
baseClass='hello'
className='world'
classNames={['world2']}
onClick={() => {
alert('asd')
}}
>Tagas</Tag>
))
}
</Tag>
</ThemeProvider>
);
}
const rootEle = document.getElementById('root')
if (rootEle) {
const root = createRoot(rootEle);
root.render(<App />);
}