/* eslint-disable max-lines-per-function */ import React from "react"; import { fontSizes, fontWeights, fonts, lineHeights, styled } from "../../theme"; import { commonProps } from "../../utils/storybook"; import { Text, typographyVariants } from "."; import type { StoryObj, Meta } from "@storybook/react"; /** * The Typography System */ const meta: Meta = { title: "Text", component: Text, tags: ["autodocs"], argTypes: { variant: { options: Object.keys(typographyVariants), }, children: { type: "string", table: { type: { summary: "string" }, }, }, ...commonProps, }, }; export default meta; type Story = StoryObj; const Th: React.FC<{ children: React.ReactNode }> = ({ children }) => ( {children} ); const Tr: React.FC<{ children: React.ReactNode }> = ({ children }) => ( {children} ); const Td: React.FC<{ children: React.ReactNode }> = ({ children }) => ( {children} ); export const Default: Story = { render: (args) => ( I am some text ), }; const StyledTable = styled("table", { borderCollapse: "collapse", color: "$light-off-white" }); export const CompleteTypography: Story = { render: () => ( Variant Typestyle Font Family Weight Font Size Line Height {Object.entries(typographyVariants).map(([textVariant, properties]) => { const variant = textVariant as React.ComponentProps["variant"]; const fontWeightName = (properties.fontWeight as string).slice( 1 ) as unknown as keyof typeof fontWeights; const fontWeight = fontWeights[fontWeightName]; const fontSize = fontSizes[(properties.fontSize as string).slice(1) as unknown as keyof typeof fontSizes]; const lineHeight = lineHeights[ (properties.lineHeight as string).slice(1) as unknown as keyof typeof lineHeights ]; return ( {variant?.toString()} {`font-size-${fontSize}-${fontWeight}`} {fonts[(properties.fontFamily as string).slice(1) as unknown as keyof typeof fonts]} {`${fontWeightName}/${fontWeight}`} {fontSize} {lineHeight} ); })} ), };