File size: 4,172 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 |
"use client"
import { Box, For, HStack, Stack, Text, defaultSystem } from "@chakra-ui/react"
import { TokenDoc } from "./token-doc"
const { tokens, _config } = defaultSystem
const fonts = Object.keys(_config.theme?.tokens?.fonts ?? {})
const fontSizes = Object.keys(_config.theme?.tokens?.fontSizes ?? {})
const fontWeights = Object.keys(_config.theme?.tokens?.fontWeights ?? {})
const lineHeights = Object.keys(_config.theme?.tokens?.lineHeights ?? {})
const letterSpacings = Object.keys(_config.theme?.tokens?.letterSpacings ?? {})
export const FontTokenDoc = () => {
return (
<TokenDoc title="theme.tokens.fonts" mt="8">
<Stack gap="8">
<For each={fonts}>
{(font) => {
const token = tokens.getByName(`fonts.${font}`)
return (
<Stack key={font} flex="1">
<Text fontSize="3xl" fontFamily={font}>
Ag
</Text>
<Box>{font}</Box>
<Box
as="pre"
whiteSpace="balance"
color="fg.muted"
fontSize="xs"
>
{token?.originalValue}
</Box>
</Stack>
)
}}
</For>
</Stack>
</TokenDoc>
)
}
export const FontSizeTokenDoc = () => {
return (
<TokenDoc title="theme.tokens.fontSizes" mt="8">
<Stack gap="4">
{fontSizes.map((fontSize) => {
const token = tokens.getByName(`fontSizes.${fontSize}`)!
return (
<Stack key={fontSize} direction="row" align="center">
<Text width="4rem">{token.extensions.prop}</Text>
<Text width="6rem" color="fg.muted">
{token.value}
</Text>
<Text fontSize={token.value}>Ag</Text>
</Stack>
)
})}
</Stack>
</TokenDoc>
)
}
export const FontWeightTokenDoc = () => {
return (
<TokenDoc title="theme.tokens.fontWeights" mt="8">
<Stack gap="4">
{fontWeights.map((fontWeight) => {
const token = tokens.getByName(`fontWeights.${fontWeight}`)!
return (
<Stack key={fontWeight} direction="row" align="center">
<Text width="6rem">{token.extensions.prop}</Text>
<Text width="6rem" color="fg.muted">
{token.value}
</Text>
<Text fontWeight={token.value} fontSize="2xl">
Ag
</Text>
</Stack>
)
})}
</Stack>
</TokenDoc>
)
}
export const LineHeightTokenDoc = () => {
return (
<TokenDoc title="theme.tokens.lineHeights" mt="8">
<Stack gap="8">
{lineHeights.map((lineHeight) => {
const token = tokens.getByName(`lineHeights.${lineHeight}`)!
return (
<Stack key={lineHeight}>
<HStack color="fg.muted">
<Text>
{token.extensions.prop} / {token.value}
</Text>
</HStack>
<Text fontSize="2xl" lineHeight={token.value}>
Naruto is a Japanese manga series written and illustrated by
Masashi Kishimoto. It tells the story of Naruto Uzumaki, a young
ninja who seeks recognition from his peers and dreams of
becoming the Hokage, the leader of his village.
</Text>
</Stack>
)
})}
</Stack>
</TokenDoc>
)
}
export const LetterSpacingTokenDoc = () => {
return (
<TokenDoc title="theme.tokens.letterSpacings" mt="8">
<Stack gap="4">
{letterSpacings.map((letterSpacing) => {
const token = tokens.getByName(`letterSpacings.${letterSpacing}`)!
return (
<Stack key={letterSpacing}>
<Text color="fg.muted">
{token.extensions.prop} / {token.value}
</Text>
<Text fontSize="2xl" letterSpacing={token.value}>
Naruto Uzumaki
</Text>
</Stack>
)
})}
</Stack>
</TokenDoc>
)
}
|