import React from 'react'; import isString from 'lodash/isString'; import {ColorItem, IconItem, Typeset} from '@storybook/blocks'; import type { TypographySizesType, TypographyWeights, } from '../../components/common/atoms/typography/typography.type'; export const colorToPalette = ( colorObj: string | Object, prefixName?: string, ) => { return Object.entries(colorObj).map(([colorName, colorValue], index) => { const title = prefixName ? `${prefixName}.${colorName}` : colorName; if (isString(colorValue)) return ( ); else return (
{colorToPalette(colorValue, title)}
); }); }; export const fontToPalette = ( fontSizes: Record, fontWeight: Record, fontFamily: string, sampleText: string = 'this is test text.', ) => { return Object.entries(fontWeight).map( ([fontWeightName, fontWeightValue], index) => { return (
{`font family: ${fontFamily}, font weight: ${fontWeightName}`}
); }, ); }; export const generateIconGallery = (IconModule: Object) => { return Object.entries(IconModule).map(([iconName, Icon], key) => { return ( ); }); };