File size: 1,524 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
"use client"

import { Box, Flex, Stack, Text, defaultSystem } from "@chakra-ui/react"
import { TokenDoc } from "./token-doc"

const { tokens } = defaultSystem

const allSpacing = tokens.categoryMap.get("spacing")!.values()
export const defaultSpacings = Array.from(allSpacing)
  .filter(
    (token) =>
      token.extensions.category === "spacing" && !token.extensions.negative,
  )
  .sort((a, b) => parseFloat(a.value) - parseFloat(b.value))

export const SpacingTokenDoc = () => {
  return (
    <TokenDoc title="theme.tokens.spacing" mt="8">
      <Flex
        fontSize="sm"
        fontWeight="medium"
        py="1"
        px="3"
        borderBottomWidth="1px"
      >
        <Text width="100px">Name</Text>
        <Text width="100px">Value</Text>
        <Text width="100px">Pixel</Text>
      </Flex>

      <Stack px="3" pt="2">
        {defaultSpacings.map((token) => (
          <Flex key={token.name} py="1" fontSize="sm">
            <Text width="100px" fontWeight="medium">
              {token.extensions.prop}
            </Text>
            <Text width="100px" color="fg.muted">
              {token.value}
            </Text>
            <Text width="100px" color="fg.muted">
              {token.extensions.pixelValue}
            </Text>
            <Box flex="1">
              <Box
                bg="pink.200"
                height="4"
                width={token.extensions.cssVar!.ref}
              />
            </Box>
          </Flex>
        ))}
      </Stack>
    </TokenDoc>
  )
}