import React from "react"; import { Meta, StoryFn } from "@storybook/react"; import CssCustomProperties from "../../common/utils/CssCustomProperties"; import { Section, SectionHeader, Spacing, Table, TableBody, TableCell, TableContainer, TableHead, TableHeader, TableRow, TitleSubsection, } from "../../components"; import { CLASSPREFIX as eccgui } from "../../index"; const groups: { title: string; filterName: (name: string) => boolean }[] = [ { title: "Typography", filterName: (name) => name.startsWith(`--${eccgui}-size-typo`), }, { title: "Font weights and spacing", filterName: (name) => name.startsWith(`--${eccgui}-font`), }, { title: "Whitespace", filterName: (name) => name.startsWith(`--${eccgui}-size-block`) || name.startsWith(`--${eccgui}-size-inline`), }, { title: "Color aliases", filterName: (name) => name.startsWith(`--${eccgui}-color`) && !name.startsWith(`--${eccgui}-color-palette`), }, { title: "Accessibility", filterName: (name) => name.startsWith(`--${eccgui}-a11y`), }, { title: "Opacity", filterName: (name) => name.startsWith(`--${eccgui}-opacity`), }, { title: "Palette colors", filterName: (name) => name.startsWith(`--${eccgui}-color-palette`), }, ]; const CssCustomPropertiesOverview = () => { return ( <> {groups.map(({ title, filterName }) => { const properties = new CssCustomProperties({ selectorText: ":root", filterName, removeDashPrefix: false, returnObject: false, }).customProperties() as string[][]; return (
{title} CSS custom property Current value {properties.map(([name, value]) => ( {name} {name.startsWith(`--${eccgui}-color`) && ( )} {value} ))}
); })} ); }; /** * We mirror our SCSS configuration variables as CSS custom vars. * This way they can be easily used for inline styles or in CSS modules without SCSS includes. */ export default { title: "Configuration/CSS Custom Properties", component: CssCustomPropertiesOverview, } as Meta; export const Default: StoryFn = () => ;