File size: 11,954 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
import * as Playground from "@/components/playground"
import {
  Avatar,
  Box,
  Button,
  Code,
  Container,
  For,
  HStack,
  Kbd,
  SimpleGrid,
  Spinner,
  Stack,
  Tabs,
} from "@chakra-ui/react"
import { PaginationBasic } from "compositions/examples/pagination-basic"
import { StepsBasic } from "compositions/examples/steps-basic"
import { TimelineBasic } from "compositions/examples/timeline-basic"
import { Blockquote } from "compositions/ui/blockquote"
import { Checkbox } from "compositions/ui/checkbox"
import {
  ProgressCircleRing,
  ProgressCircleRoot,
} from "compositions/ui/progress-circle"
import { Radio, RadioGroup } from "compositions/ui/radio"
import { Rating } from "compositions/ui/rating"
import { Slider } from "compositions/ui/slider"
import { Switch } from "compositions/ui/switch"
import { Metadata } from "next"
import { cookies } from "next/headers"
import { LuArrowRight } from "react-icons/lu"
import { ThemePanel } from "./theme-panel"

export const metadata: Metadata = {
  title: "Playground",
  openGraph: {
    images: `/og?title=Playground`,
  },
}

const buttonVariants = [
  "solid",
  "outline",
  "ghost",
  "subtle",
  "surface",
  "plain",
] as const

export default async function Page() {
  const cookieStore = await cookies()
  const accentColor = cookieStore.get("chakra-accent-color")
  const fontFamily = cookieStore.get("chakra-font")
  const radius = cookieStore.get("chakra-radius")

  return (
    <Container display="flex" gap="10" maxW="8xl">
      <Box
        maxW="5xl"
        width="full"
        flex="1"
        minHeight="var(--content-height)"
        overflow="auto"
      >
        <Playground.Section>
          <Playground.SectionTitle id="button">Button</Playground.SectionTitle>
          <Playground.SectionContent>
            <Playground.DemoList
              items={[
                {
                  label: "Accent Colors",
                  component: (
                    <HStack>
                      <For each={buttonVariants}>
                        {(variant) => (
                          <Button key={variant} variant={variant}>
                            Click <LuArrowRight />
                          </Button>
                        )}
                      </For>
                    </HStack>
                  ),
                },
                {
                  label: "Gray",
                  component: (
                    <HStack colorPalette="gray">
                      <For each={buttonVariants}>
                        {(variant) => (
                          <Button key={variant} variant={variant}>
                            Click <LuArrowRight />
                          </Button>
                        )}
                      </For>
                    </HStack>
                  ),
                },
              ]}
            />
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="code">Code</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack wrap="wrap" gap="4">
              <For each={["subtle", "surface", "outline", "solid"]}>
                {(variant) => (
                  <Code size="md" variant={variant} key={variant}>
                    console.log()
                  </Code>
                )}
              </For>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="avatar">Avatar</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack wrap="wrap" gap="4">
              <For each={["subtle", "solid"]}>
                {(variant) => (
                  <HStack key={variant}>
                    <Avatar.Root variant={variant} size="lg" shape="rounded">
                      <Avatar.Image src="https://bit.ly/sage-adebayo" />
                      <Avatar.Fallback name="Sage Adebayo" />
                    </Avatar.Root>
                    <Avatar.Root variant={variant} size="lg" shape="rounded">
                      <Avatar.Fallback name="Dan Abramov" />
                    </Avatar.Root>
                    <Avatar.Root variant={variant} size="lg" shape="rounded">
                      <Avatar.Fallback />
                    </Avatar.Root>
                  </HStack>
                )}
              </For>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="tabs">Tabs</Playground.SectionTitle>
          <Playground.SectionContent>
            <SimpleGrid columns={2} gapX="4" gapY="8">
              <For each={["line", "subtle", "enclosed", "outline"]}>
                {(variant) => (
                  <HStack key={variant}>
                    <Tabs.Root variant={variant} defaultValue="components">
                      <Tabs.List>
                        <Tabs.Trigger value="components">
                          Components
                        </Tabs.Trigger>
                        <Tabs.Trigger value="hooks">Hooks</Tabs.Trigger>
                        <Tabs.Trigger value="utilities">Utilities</Tabs.Trigger>
                      </Tabs.List>
                    </Tabs.Root>
                  </HStack>
                )}
              </For>
            </SimpleGrid>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="checkbox">
            Checkbox
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack wrap="wrap" gap="8">
              <For each={["solid", "outline", "subtle"]}>
                {(variant) => (
                  <Stack key={variant} gap="5">
                    <Checkbox variant={variant}>Accept terms</Checkbox>
                    <Checkbox defaultChecked variant={variant}>
                      Accept terms
                    </Checkbox>
                  </Stack>
                )}
              </For>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="pagination">
            Pagination
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <PaginationBasic />
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="radio">Radio</Playground.SectionTitle>
          <Playground.SectionContent>
            <Stack wrap="wrap" gap="6">
              <For each={["solid", "outline", "subtle"]}>
                {(variant) => (
                  <RadioGroup
                    defaultValue="two"
                    variant={variant}
                    key={variant}
                  >
                    <HStack gap="5">
                      <Radio value="one">Radio one</Radio>
                      <Radio value="two">Radio second</Radio>
                    </HStack>
                  </RadioGroup>
                )}
              </For>
            </Stack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="rating">Rating</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack wrap="wrap" gap="8">
              <Rating defaultValue={3} size="sm" />
              <Rating defaultValue={3} size="sm" colorPalette="gray" />
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="switch">Switch</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack wrap="wrap" gap="8">
              <Switch />
              <Switch defaultChecked />
              <Switch defaultChecked colorPalette="gray" />
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="blockquote">
            Blockquote
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <Stack gap="8">
              <For each={["subtle", "solid"]}>
                {(variant) => (
                  <Blockquote
                    key={variant}
                    showDash
                    cite="Uzumaki Naruto"
                    variant={variant}
                  >
                    If anyone thinks he is something when he is nothing, he
                    deceives himself. Each one should test his own actions. Then
                    he can take pride in himself, without comparing himself to
                    anyone else.
                  </Blockquote>
                )}
              </For>
            </Stack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="slider">Slider</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack gap="8" maxW="400px" w="full">
              <For each={["outline", "solid"]}>
                {(variant) => (
                  <Slider
                    key={variant}
                    flex="1"
                    variant={variant}
                    defaultValue={[50]}
                  />
                )}
              </For>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="progress-circle">
            Progress Circle
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack gap="8" maxW="400px" w="full">
              <ProgressCircleRoot size="md" value={30}>
                <ProgressCircleRing cap="round" />
              </ProgressCircleRoot>
              <ProgressCircleRoot size="md" value={30} colorPalette="gray">
                <ProgressCircleRing cap="round" />
              </ProgressCircleRoot>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="kbd">Kbd</Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack gap="4" maxW="400px" w="full">
              <Kbd size="sm">⌘ C</Kbd>
              <Kbd size="md">⌘ C</Kbd>
              <Kbd size="lg">⌘ C</Kbd>
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="spinner">
            Spinner
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <HStack gap="8" ps="4">
              <Spinner size="sm" color="colorPalette.solid" />
              <Spinner size="md" color="colorPalette.solid" />
              <Spinner size="lg" color="colorPalette.solid" />
            </HStack>
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="steps">Steps</Playground.SectionTitle>
          <Playground.SectionContent>
            <StepsBasic />
          </Playground.SectionContent>
        </Playground.Section>

        <Playground.Section>
          <Playground.SectionTitle id="timeline">
            Timeline
          </Playground.SectionTitle>
          <Playground.SectionContent>
            <TimelineBasic />
          </Playground.SectionContent>
        </Playground.Section>
      </Box>

      <Box w="sm" hideBelow="md" />

      <Box pos="fixed" pt="8" top="24" right="12" hideBelow="md">
        <ThemePanel
          accentColor={accentColor?.value}
          fontFamily={fontFamily?.value}
          radius={radius?.value}
        />
      </Box>
    </Container>
  )
}