diff --git a/.changeset/quiet-kangaroos-cheer.md b/.changeset/quiet-kangaroos-cheer.md new file mode 100644 index 000000000..3d8cb2869 --- /dev/null +++ b/.changeset/quiet-kangaroos-cheer.md @@ -0,0 +1,5 @@ +--- +'@pandacss/studio': patch +--- + +Fix issue where throws "React is not defined error" diff --git a/packages/studio/package.json b/packages/studio/package.json index 4d600da55..098cd4062 100644 --- a/packages/studio/package.json +++ b/packages/studio/package.json @@ -41,6 +41,7 @@ "src", "public", "styled-system", + "tsconfig.json", "*.ts", "*.mjs" ], diff --git a/packages/studio/panda.config.ts b/packages/studio/panda.config.ts index 300eab232..edcda689d 100644 --- a/packages/studio/panda.config.ts +++ b/packages/studio/panda.config.ts @@ -55,41 +55,19 @@ export default { border: { value: { base: '{colors.neutral.300}', _dark: '{colors.neutral.700}' }, }, + accent: { + value: { base: '{colors.yellow.600}', _dark: '{colors.yellow.300}' }, + }, }, }, }, }, - patterns: { - extend: { - styledLink: { - properties: {}, - transform: (props: any) => ({ - display: 'inline-flex', - alignItems: 'center', - opacity: '0.5', - borderBottom: '1px solid transparent', - cursor: 'pointer', - _hover: { opacity: 1, borderBottomColor: 'black' }, - ...props, - }), - }, - }, - }, - staticCss: { - css: [ - { - properties: { - color: ['red.400'], - }, - }, - ], - }, globalCss: { ':root': { '--global-color-border': 'colors.border', '--global-color-placeholder': 'colors.neutral.500', fontFamily: 'Inter, Avenir, Helvetica, Arial, sans-serif', - fontSize: 'md', + fontSize: '0.84em', lineHeight: 'normal', fontWeight: 'normal', colorScheme: 'light dark', @@ -104,7 +82,7 @@ export default { body: { margin: 0, - minHeight: '100vh', + minHeight: '100dvh', }, }, } satisfies Config diff --git a/packages/studio/src/components/color-constrast.tsx b/packages/studio/src/components/color-constrast.tsx index 61b7360c6..09b71ceda 100644 --- a/packages/studio/src/components/color-constrast.tsx +++ b/packages/studio/src/components/color-constrast.tsx @@ -1,46 +1,51 @@ -import { useState } from 'react' +import * as React from 'react' import { HStack, Stack, VStack, panda } from '../../styled-system/jsx' import { getContrastPairs, getContrastRatio } from '../lib/color' -import context from '../lib/panda.context' -import { ErrorIcon, SuccessIcon } from './icons' +import * as context from '../lib/panda-context' +import { Select } from './input' +import { TestScore } from './test-score' import { TokenContent } from './token-content' import { TokenGroup } from './token-group' -function TestScore(props: { score: { WCAG_AA: boolean; WCAG_AAA: boolean }; size: 'regular' | 'large' }) { - const { score, size } = props +interface ColorSelectProps { + title: string + value: string + colors: { + label: string + value: string + }[] + onChange: (value: string) => void +} + +function ColorSelect(props: ColorSelectProps) { + const { title, colors, onChange, value } = props return ( - <> - - - {score.WCAG_AA ? : } - AA - - {size === 'regular' ? '4.5:1' : '3:1'} - - - - {score.WCAG_AAA ? : } - AAA - - {size === 'regular' ? '7:1' : '4.5:1'} - - > + + {title} + + onChange(e.currentTarget.value)}> + {colors.map((color) => ( + + {color.label} + + ))} + + ) } -export function ColorContrastChecker() { - const colorsMap = context.getCategory('colors') - const values = Array.from(colorsMap.values()) - - const colors = values - .filter((color) => !color.isConditional && !color.extensions.isVirtual) - .map((color) => ({ - label: color.extensions.prop, - value: color.value, - })) +export default function ColorContrastChecker() { + const colors = context.colors - const [foreground, setForeGround] = useState('#000000') - const [background, setBackground] = useState('#ffffff') + const [foreground, setForeGround] = React.useState('#000000') + const [background, setBackground] = React.useState('#ffffff') const activeForeground = (colors.find((col) => col.label === foreground)?.value || foreground) as string const activeBackground = (colors.find((col) => col.label === background)?.value || background) as string @@ -52,40 +57,8 @@ export function ColorContrastChecker() { - - setForeGround(e.currentTarget.value)}> - {colors.map((color) => ( - - {color.label} - - ))} - - - - setBackground(e.currentTarget.value)}> - {colors.map((color) => ( - - {color.label} - - ))} - - + + ) { - return ( - - ) -} +export const ColorWrapper = panda('div', { + base: { + width: 'full', + height: '10', + borderRadius: 'sm', + position: 'relative', + overflow: 'hidden', + shadow: 'inset', + _before: { + content: "''", + position: 'absolute', + borderRadius: 'sm', + width: '100%', + height: '100%', + backgroundSize: '24px', + zIndex: '-1', + backgroundImage: 'check', + }, + }, +}) diff --git a/packages/studio/src/components/colors.tsx b/packages/studio/src/components/colors.tsx index 637eb08ea..be06c8513 100644 --- a/packages/studio/src/components/colors.tsx +++ b/packages/studio/src/components/colors.tsx @@ -1,3 +1,5 @@ +import type { Token } from '@pandacss/token-dictionary' +import * as React from 'react' import { Grid, HStack, Stack, panda } from '../../styled-system/jsx' import { ColorWrapper } from '../components/color-wrapper' import { TokenContent } from '../components/token-content' @@ -5,6 +7,7 @@ import { TokenGroup } from '../components/token-group' import { useColorDocs } from '../lib/use-color-docs' import { Input } from './input' import { SemanticColorDisplay } from './semantic-color' +import { StickyTop } from './sticky-top' const UNCATEGORIZED_ID = 'uncategorized' as const @@ -12,14 +15,14 @@ function getColorFromReference(reference: string) { return reference.match(/{colors\.(.*?)}/)?.[1] } -export function Colors() { +export default function Colors() { const { filterQuery, setFilterQuery, semanticTokens, hasResults, uncategorizedColors, categorizedColors } = useColorDocs() const renderSemanticTokens = () => { return semanticTokens.map(([name, colors], i) => { return ( - + { - return values?.map((color, i) => { - return ( - - - - {color.extensions.prop} - - {color.value} - - - - ) - }) - } return ( - + setFilterQuery(e.target.value)} placeholder="Filter tokens by text, property or value" /> - + + - {!!categorizedColors.length && - categorizedColors.map(([category, colors]) => ( - - - {category} - + {categorizedColors.map(([category, colors]) => ( + + ))} + + + + {!!semanticTokens.length && {renderSemanticTokens()}} - - {renderColors(colors)} - - - ))} - {!!uncategorizedColors?.length && ( - - - {UNCATEGORIZED_ID} - - - {renderColors(uncategorizedColors)} - - - )} - {!!semanticTokens.length && ( - - - Semantic tokens - - - {renderSemanticTokens()} - - - )} {!hasResults && No result found! 🐼} ) } + +function PrimitiveColors(props: { values?: Token[] }) { + const { values = [] } = props + return values.map((color, i) => { + return ( + + + + {color.extensions.prop} + + {color.value} + + + + ) + }) +} + +function ColorGroup(props: { colors?: Token[]; title: string; children?: React.ReactNode }) { + const { children, colors, title } = props + + const isEmpty = colors == null || colors.length === 0 + + if (!children && isEmpty) return null + + return ( + + + {title} + + {children ? ( + + {children} + + ) : ( + + + + )} + + ) +} diff --git a/packages/studio/src/components/empty-state.tsx b/packages/studio/src/components/empty-state.tsx index d09201e40..92060b621 100644 --- a/packages/studio/src/components/empty-state.tsx +++ b/packages/studio/src/components/empty-state.tsx @@ -1,3 +1,4 @@ +import * as React from 'react' import { panda, Stack } from '../../styled-system/jsx' interface EmptyStateProps { @@ -6,13 +7,14 @@ interface EmptyStateProps { icon: React.ReactElement } -export function EmptyState({ title, children, icon }: EmptyStateProps) { +export function EmptyState(props: EmptyStateProps) { + const { title, children, icon } = props return ( {icon} {title} - {children} + {children} ) diff --git a/packages/studio/src/components/font-family.tsx b/packages/studio/src/components/font-family.tsx index 16cbeb454..0a117c2b7 100644 --- a/packages/studio/src/components/font-family.tsx +++ b/packages/studio/src/components/font-family.tsx @@ -1,17 +1,17 @@ +import * as React from 'react' import { Flex, HStack, Square, Stack, panda } from '../../styled-system/jsx' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' -const fonts = context.getCategory('fonts') +const fonts = context.getTokens('fonts') const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i)) const symbols = Array.from({ length: 10 }, (_, i) => String.fromCharCode(48 + i)) const specials = ['@', '#', '$', '%', '&', '!', '?', '+', '-'] export const FontFamily = () => { - const values = Array.from(fonts.values()) return ( - {values.map((font) => ( + {fonts.map((font) => ( diff --git a/packages/studio/src/components/font-tokens.tsx b/packages/studio/src/components/font-tokens.tsx index 47bf2ba01..89fec527b 100644 --- a/packages/studio/src/components/font-tokens.tsx +++ b/packages/studio/src/components/font-tokens.tsx @@ -1,50 +1,41 @@ -import { Fragment, useState } from 'react' +import type { Token } from '@pandacss/token-dictionary' +import * as React from 'react' import { HStack, panda, Stack } from '../../styled-system/jsx' import { TokenContent } from '../components/token-content' import { TokenGroup } from '../components/token-group' import { Input, Textarea } from './input' +import { StickyTop } from './sticky-top' interface FontTokensProps { text?: string largeText?: boolean token: string - fontTokens: Map + fontTokens: Token[] css?: any } -export function FontTokens(props: FontTokensProps) { +export default function FontTokens(props: FontTokensProps) { const { text: textProp = 'Hello World', largeText = false, token, fontTokens } = props - const [text, setText] = useState(textProp) - const values = Array.from(fontTokens.values()) + const [text, setText] = React.useState(textProp) + + const handleChange = (event: React.ChangeEvent) => { + setText(event.target.value) + } return ( - + {largeText ? ( - { - setText(event.currentTarget.value) - }} - rows={5} - value={text} - placeholder="Preview Text" - /> + ) : ( - { - setText(event.currentTarget.value) - }} - placeholder="Preview Text" - /> + )} - + - {values.map((fontToken) => ( - + {fontTokens.map((fontToken) => ( + {fontToken.extensions.prop} @@ -61,7 +52,7 @@ export function FontTokens(props: FontTokensProps) { {text} - + ))} diff --git a/packages/studio/src/components/icons.tsx b/packages/studio/src/components/icons.tsx index a7b626a8f..99013fde2 100644 --- a/packages/studio/src/components/icons.tsx +++ b/packages/studio/src/components/icons.tsx @@ -1,3 +1,5 @@ +import * as React from 'react' + export function ErrorIcon() { return ( diff --git a/packages/studio/src/components/input.tsx b/packages/studio/src/components/input.tsx index 47613773e..c200104dd 100644 --- a/packages/studio/src/components/input.tsx +++ b/packages/studio/src/components/input.tsx @@ -3,9 +3,9 @@ import { panda } from '../../styled-system/jsx' export const inputRecipe = cva({ base: { - bg: 'transparent', + bg: 'card', width: 'full', - px: '4', + px: '3', py: '2', rounded: 'md', color: { base: 'neutral.600', _dark: 'neutral.300' }, @@ -25,3 +25,5 @@ export const inputRecipe = cva({ export const Input = panda('input', inputRecipe) export const Textarea = panda('textarea', inputRecipe) + +export const Select = panda('select', inputRecipe) diff --git a/packages/studio/src/components/layer-styles.tsx b/packages/studio/src/components/layer-styles.tsx index 8c0b810fc..88ec0cd1e 100644 --- a/packages/studio/src/components/layer-styles.tsx +++ b/packages/studio/src/components/layer-styles.tsx @@ -1,11 +1,12 @@ +import * as React from 'react' import { panda } from '../../styled-system/jsx' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' import { EmptyState } from './empty-state' import { LayerStylesIcon } from './icons' import { TokenContent } from './token-content' import { TokenGroup } from './token-group' -export function LayerStyles() { +export default function LayerStyles() { const values = Object.entries(context.layerStyles) return ( @@ -29,7 +30,7 @@ export function LayerStyles() { )) ) : ( }> - The config does not contain any Layer Styles + The panda config does not contain any layer styles )} diff --git a/packages/studio/src/components/nav-item.tsx b/packages/studio/src/components/nav-item.tsx deleted file mode 100644 index b604eb82a..000000000 --- a/packages/studio/src/components/nav-item.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { panda } from '../../styled-system/jsx' -import type { NavItemData } from '../lib/constants' - -export function NavItem(props: NavItemData) { - return ( - - - - - - - {props.label} - - - {props.description} - - - - ) -} diff --git a/packages/studio/src/components/overview.tsx b/packages/studio/src/components/overview.tsx index bd5224172..9401897ba 100644 --- a/packages/studio/src/components/overview.tsx +++ b/packages/studio/src/components/overview.tsx @@ -1,65 +1,85 @@ -import { css } from '../../styled-system/css' -import { panda, Wrap } from '../../styled-system/jsx' -import { NavItem } from './nav-item' +import * as React from 'react' +import { css, cva } from '../../styled-system/css' +import { flex, hstack, square, vstack } from '../../styled-system/patterns' +import { Yums } from '../icons/yums' +import { Logo } from '../icons/logo' +import { Wrap } from '../../styled-system/jsx' import { navItems } from '../lib/constants' -import { Logo } from './logo' -export function Overview() { +const buttonRecipe = cva({ + base: { + display: 'inline-flex', + px: '6', + py: '3', + fontWeight: 'medium', + fontSize: '2xl', + rounded: 'sm', + }, + variants: { + variant: { + solid: { + bg: 'yellow.300', + color: 'black', + }, + outline: { + borderWidth: '1px', + color: 'yellow.300', + }, + }, + }, +}) + +export default function Overview() { return ( - - + + - - - - Design System - - Build great products, faster. - - Explore - - - - - TOKENS - - {navItems - .filter((k) => k.type === 'token') - .map((data, index) => ( - - ))} - + + + + Panda Studio + Live documentation for your design tokens (colors, fonts, etc.) - - PLAYGROUND - - {navItems - .filter((k) => k.type === 'playground') - .map((data, index) => ( - - ))} - + + + + Get Started + + + View Docs + - - + + + {navItems + .filter((k) => k.type === 'token') + .map((item, index) => ( + + + + + + ))} + + + ) } diff --git a/packages/studio/src/components/radii.tsx b/packages/studio/src/components/radii.tsx index 5de71c51a..22e69a600 100644 --- a/packages/studio/src/components/radii.tsx +++ b/packages/studio/src/components/radii.tsx @@ -1,12 +1,13 @@ +import * as React from 'react' import { toPx } from '@pandacss/shared' import { Grid, panda, Stack } from '../../styled-system/jsx' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' import { getSortedSizes } from '../lib/sizes-sort' import { TokenGroup } from './token-group' -const radii = context.getCategory('radii') +const radii = context.getTokens('radii') -export function Radii() { +export default function Radii() { return ( {radii && ( @@ -14,14 +15,14 @@ export function Radii() { {getSortedSizes([...radii.values()]) .sort((a, b) => parseFloat(toPx(a.value)!) - parseFloat(toPx(b.value)!)) .map((size, index) => ( - + - + {size.extensions.prop} {size.value} diff --git a/packages/studio/src/components/semantic-color.tsx b/packages/studio/src/components/semantic-color.tsx index 00c1e58aa..ea8ce5d57 100644 --- a/packages/studio/src/components/semantic-color.tsx +++ b/packages/studio/src/components/semantic-color.tsx @@ -1,6 +1,7 @@ +import * as React from 'react' import { Flex, panda } from '../../styled-system/jsx' import { ColorWrapper } from './color-wrapper' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' const getSemanticColorValue = (variable: string): string => { const _name = variable.match(/var\(\s*--(.*?)\s*\)/) @@ -22,7 +23,7 @@ const getSemanticColorValue = (variable: string): string => { const cleanCondition = (condition: string) => condition.replace(/^_/, '') export function SemanticColorDisplay(props: { value: string; condition: string; token?: string }) { - const { value, condition, token } = props + const { value, condition } = props const tokenValue = getSemanticColorValue(value) @@ -44,10 +45,7 @@ export function SemanticColorDisplay(props: { value: string; condition: string; {cleanCondition(condition)} - - {token} - - + {value} {value !== tokenValue && `- ${tokenValue}`} diff --git a/packages/studio/src/components/side-nav-item.astro b/packages/studio/src/components/side-nav-item.astro index eb79feb4e..39492450d 100644 --- a/packages/studio/src/components/side-nav-item.astro +++ b/packages/studio/src/components/side-nav-item.astro @@ -18,7 +18,7 @@ const isActive = Astro.url.pathname.startsWith(href) fontSize="md" fontWeight="medium" aria-current={isActive ? 'page' : undefined} - color={{ _hover: 'yellow.300', _currentPage: 'yellow.300' }} + color={{ _hover: 'accent', _currentPage: 'accent' }} > diff --git a/packages/studio/src/components/side-nav.astro b/packages/studio/src/components/side-nav.astro index dc2bc752b..1301aa03a 100644 --- a/packages/studio/src/components/side-nav.astro +++ b/packages/studio/src/components/side-nav.astro @@ -1,7 +1,7 @@ --- import { navItems } from '../lib/constants' import { panda, Stack } from '../../styled-system/jsx' -import NavItem from './side-nav-item.astro' +import SideNavItem from './side-nav-item.astro' --- @@ -12,7 +12,7 @@ import NavItem from './side-nav-item.astro' { navItems .filter((item) => item.type === 'token') - .map((item) => {item.label}) + .map((item) => {item.label}) } @@ -22,7 +22,7 @@ import NavItem from './side-nav-item.astro' { navItems .filter((item) => item.type === 'playground') - .map((item) => {item.label}) + .map((item) => {item.label}) } diff --git a/packages/studio/src/components/sizes.tsx b/packages/studio/src/components/sizes.tsx index 524c1e6af..e76e86c38 100644 --- a/packages/studio/src/components/sizes.tsx +++ b/packages/studio/src/components/sizes.tsx @@ -1,21 +1,22 @@ +import * as React from 'react' import { toPx } from '@pandacss/shared' import { Fragment } from 'react' import { Grid, panda } from '../../styled-system/jsx' import { getSortedSizes } from '../lib/sizes-sort' import { TokenGroup } from './token-group' +import type { Token } from '@pandacss/token-dictionary' export interface SizesProps { - sizes: Map + sizes: Token[] } const contentRegex = /^(min|max|fit)-content$/ const unitRegex = /(ch|%)$/ -export function Sizes(props: SizesProps) { - const { sizes: tokens } = props - const values = Array.from(tokens.values()) +export default function Sizes(props: SizesProps) { + const { sizes } = props - const sizes = getSortedSizes(values).filter( + const sortedSizes = getSortedSizes(sizes).filter( (token) => // remove negative values !token.extensions.isNegative && @@ -35,7 +36,7 @@ export function Sizes(props: SizesProps) { Pixels - {sizes + {sortedSizes .sort((a, b) => a.extensions.prop - b.extensions.prop) .map((size, index) => ( diff --git a/packages/studio/src/components/sticky-top.tsx b/packages/studio/src/components/sticky-top.tsx new file mode 100644 index 000000000..47f7090f9 --- /dev/null +++ b/packages/studio/src/components/sticky-top.tsx @@ -0,0 +1,10 @@ +import { panda } from '../../styled-system/jsx' + +export const StickyTop = panda('div', { + base: { + position: 'sticky', + top: '6', + zIndex: '1', + mb: '4', + }, +}) diff --git a/packages/studio/src/components/test-score.tsx b/packages/studio/src/components/test-score.tsx new file mode 100644 index 000000000..1ceb3750d --- /dev/null +++ b/packages/studio/src/components/test-score.tsx @@ -0,0 +1,35 @@ +import * as React from 'react' +import { HStack } from '../../styled-system/jsx' +import { ErrorIcon, SuccessIcon } from './icons' + +interface TestScore { + WCAG_AA: boolean + WCAG_AAA: boolean +} + +interface TestScoreProps { + score: TestScore + size: 'regular' | 'large' +} + +export function TestScore(props: TestScoreProps) { + const { score, size } = props + return ( + <> + + + {score.WCAG_AA ? : } + AA + + {size === 'regular' ? '4.5:1' : '3:1'} + + + + {score.WCAG_AAA ? : } + AAA + + {size === 'regular' ? '7:1' : '4.5:1'} + + > + ) +} diff --git a/packages/studio/src/components/text-styles.tsx b/packages/studio/src/components/text-styles.tsx index 7576c43e2..ce5d08662 100644 --- a/packages/studio/src/components/text-styles.tsx +++ b/packages/studio/src/components/text-styles.tsx @@ -1,11 +1,12 @@ +import * as React from 'react' import { panda } from '../../styled-system/jsx' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' import { EmptyState } from './empty-state' import { TextStylesIcon } from './icons' import { TokenContent } from './token-content' import { TokenGroup } from './token-group' -export function TextStyles() { +export default function TextStyles() { const textStyles = Object.entries(context.textStyles) return ( diff --git a/packages/studio/src/components/theme-toggle.astro b/packages/studio/src/components/theme-toggle.astro index 48eb216eb..9462080e4 100644 --- a/packages/studio/src/components/theme-toggle.astro +++ b/packages/studio/src/components/theme-toggle.astro @@ -17,7 +17,7 @@ const buttonStyles = hstack({ const iconStyles = css({ cursor: 'pointer', '&.active': { - color: 'yellow.300', + color: 'accent', }, }) --- diff --git a/packages/studio/src/components/token-content.tsx b/packages/studio/src/components/token-content.tsx index 6de109935..d25972fde 100644 --- a/packages/studio/src/components/token-content.tsx +++ b/packages/studio/src/components/token-content.tsx @@ -1,5 +1,9 @@ -import { type HTMLPandaProps, panda } from '../../styled-system/jsx' +import { panda } from '../../styled-system/jsx' -export function TokenContent(props: HTMLPandaProps<'div'>) { - return -} +export const TokenContent = panda('div', { + base: { + display: 'flex', + flexDirection: 'column', + gap: '12', + }, +}) diff --git a/packages/studio/src/components/token-group.tsx b/packages/studio/src/components/token-group.tsx index 6c789abba..2527d6190 100644 --- a/packages/studio/src/components/token-group.tsx +++ b/packages/studio/src/components/token-group.tsx @@ -1,6 +1,11 @@ -import type { HTMLPandaProps } from '../../styled-system/jsx' import { panda } from '../../styled-system/jsx' -export function TokenGroup(props: HTMLPandaProps<'div'>) { - return -} +export const TokenGroup = panda('div', { + base: { + display: 'flex', + flexDir: 'column', + gap: '3', + width: 'full', + marginTop: '5', + }, +}) diff --git a/packages/studio/src/components/typography-playground.tsx b/packages/studio/src/components/typography-playground.tsx index 5df395b71..25f0b6fc1 100644 --- a/packages/studio/src/components/typography-playground.tsx +++ b/packages/studio/src/components/typography-playground.tsx @@ -1,23 +1,24 @@ +import type { Token } from '@pandacss/token-dictionary' +import * as React from 'react' import { useState } from 'react' import { Stack, panda } from '../../styled-system/jsx' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' +import { Select } from './input' import { TokenContent } from './token-content' import { TokenGroup } from './token-group' -import type { Token } from '@pandacss/token-dictionary' -const getFirstToken = >(token?: T) => - token ? Array.from(token.values())[0].extensions.prop : {} const tokens = Object.fromEntries | undefined>(context.tokens.categoryMap) const defaultConfig = { - fontSize: getFirstToken(tokens.fontSizes), - letterSpacing: getFirstToken(tokens.letterSpacings), - fontWeight: getFirstToken(tokens.fontWeights), - lineHeight: getFirstToken(tokens.lineHeights), + fontSize: '', + letterSpacing: '', + fontWeight: '', + lineHeight: '', } -export function TypographyPlayground() { +export default function TypographyPlayground() { const [config, setConfig] = useState(defaultConfig) + const configValues = Object.entries(config).reduce( (acc, [token, label]) => ({ ...acc, @@ -38,18 +39,18 @@ export function TypographyPlayground() { updateConfig(key, event.currentTarget.value) } - const renderTokenSwitch = (token: keyof typeof defaultConfig) => { - const _token = tokens[`${token}s`] - if (!_token) return - const values = Array.from(_token.values()) + const renderTokenSwitch = (token: any) => { + const currentTokens = tokens[`${token}s`] + if (!currentTokens) return + const values = Array.from(currentTokens.values()) return ( - onChangeConfig(e, token)}> + onChangeConfig(e, token)}> {values.map((token) => ( {`${token.extensions.prop} (${token.value})`} ))} - + ) } @@ -67,7 +68,7 @@ export function TypographyPlayground() { width="fit-content" style={configValues} > - Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Write type-safe styles with ease using Panda CSS diff --git a/packages/studio/src/components/logo.tsx b/packages/studio/src/icons/logo.tsx similarity index 98% rename from packages/studio/src/components/logo.tsx rename to packages/studio/src/icons/logo.tsx index 575490d8d..2f0b057aa 100644 --- a/packages/studio/src/components/logo.tsx +++ b/packages/studio/src/icons/logo.tsx @@ -1,4 +1,6 @@ -export function Logo(props: React.ComponentPropsWithoutRef<'svg'>) { +import * as React from 'react' + +export function Logo(props: React.ComponentProps<'svg'>) { return ( ) => ( diff --git a/packages/studio/src/icons/sun.tsx b/packages/studio/src/icons/sun.tsx index 11c281fed..c623f7ed7 100644 --- a/packages/studio/src/icons/sun.tsx +++ b/packages/studio/src/icons/sun.tsx @@ -1,3 +1,4 @@ +import * as React from 'react' import type { ComponentProps } from 'react' export const SunIcon = (props: ComponentProps<'svg'>) => ( diff --git a/packages/studio/src/icons/yums.tsx b/packages/studio/src/icons/yums.tsx new file mode 100644 index 000000000..5a7c227d3 --- /dev/null +++ b/packages/studio/src/icons/yums.tsx @@ -0,0 +1,1144 @@ +import * as React from 'react' + +export const Yums = (props: React.ComponentProps<'svg'>) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +) diff --git a/packages/studio/src/layouts/Layout.astro b/packages/studio/src/layouts/Layout.astro index d04990a6b..b89e69604 100644 --- a/packages/studio/src/layouts/Layout.astro +++ b/packages/studio/src/layouts/Layout.astro @@ -1,7 +1,7 @@ --- import '../../styled-system/styles.css' import Head from '../components/head.astro' -import context from '../lib/panda.context' +import * as context from '../lib/panda-context' --- @@ -17,3 +17,4 @@ import context from '../lib/panda.context'
{children}
Build great products, faster.
Live documentation for your design tokens (colors, fonts, etc.)