import type { Token } from '@pandacss/token-dictionary' import * as React from 'react' import { useState } from 'react' import { Stack, panda } from '../../styled-system/jsx' import * as context from '../lib/panda-context' import { Select } from './input' import { TokenContent } from './token-content' import { TokenGroup } from './token-group' const tokens = Object.fromEntries | undefined>(context.tokens.view.categoryMap) const defaultConfig = { fontSize: '', letterSpacing: '', fontWeight: '', lineHeight: '', } export default function TypographyPlayground() { const [config, setConfig] = useState(defaultConfig) const configValues = Object.entries(config).reduce( (acc, [token, label]) => ({ ...acc, [token]: tokens[`${token}s`]?.get(label)?.value, }), {}, ) const updateConfig = (key: string, value: string) => { setConfig((prev) => ({ ...prev, [key]: value, })) } const onChangeConfig = (e: Event | React.FormEvent, key: string) => { const event = e as React.FormEvent updateConfig(key, event.currentTarget.value) } const renderTokenSwitch = (token: keyof typeof defaultConfig) => { const currentTokens = tokens[`${token}s`] if (!currentTokens) return const values = Array.from(currentTokens.values()) return ( ) } return (
Write type-safe styles with ease using Panda CSS {Object.keys(config).map((tokenKey) => ( {tokenKey.replace(/([a-z0-9])([A-Z])/g, '$1 $2')} {renderTokenSwitch(tokenKey as keyof typeof defaultConfig)} ))}
) }