diff --git a/frontend/src/app/main/ui/ds.cljs b/frontend/src/app/main/ui/ds.cljs index 10a84e5b8..805f504ff 100644 --- a/frontend/src/app/main/ui/ds.cljs +++ b/frontend/src/app/main/ui/ds.cljs @@ -17,4 +17,6 @@ ;; meta / misc :meta #js {:icons icon-list :svgs raw-svg-list} :storybook #js {:StoryGrid sb/story-grid* + :StoryGridCell sb/story-grid-cell* + :StoryHeader sb/story-header* :StoryWrapper sb/story-wrapper*}}) diff --git a/frontend/src/app/main/ui/ds/foundations/icon.stories.jsx b/frontend/src/app/main/ui/ds/foundations/icon.stories.jsx index db0b2c23c..52bb1076c 100644 --- a/frontend/src/app/main/ui/ds/foundations/icon.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/icon.stories.jsx @@ -2,7 +2,8 @@ import * as React from "react"; import Components from "@target/components"; const { Icon } = Components; -const { StoryWrapper, StoryGrid } = Components.storybook; +const { StoryWrapper, StoryGrid, StoryGridCell, StoryHeader } = + Components.storybook; const { icons } = Components.meta; export default { @@ -17,23 +18,32 @@ const iconList = Object.entries(icons) export const AllIcons = { render: () => ( - All Icons - Hover on an icon to see its ID + + All Icons + Hover on an icon to see its ID + {iconList.map((iconId) => ( - + - + ))} ), + parameters: { + backgrounds: { disable: true }, + }, }; export const Default = { render: () => ( - + ), }; @@ -41,7 +51,7 @@ export const Default = { export const Small = { render: () => ( - + ), }; diff --git a/frontend/src/app/main/ui/ds/foundations/raw_svg.stories.jsx b/frontend/src/app/main/ui/ds/foundations/raw_svg.stories.jsx index 1717a64d0..b73e6b56e 100644 --- a/frontend/src/app/main/ui/ds/foundations/raw_svg.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/raw_svg.stories.jsx @@ -2,7 +2,8 @@ import * as React from "react"; import Components from "@target/components"; const { RawSvg } = Components; -const { StoryWrapper, StoryGrid } = Components.storybook; +const { StoryWrapper, StoryGrid, StoryGridCell, StoryHeader } = + Components.storybook; const { svgs } = Components.meta; export default { @@ -16,28 +17,30 @@ const assetList = Object.entries(svgs) export const AllAssets = { render: () => ( - - All assets - Hover on a asset to see its id. + + + All assets + Hover on a asset to see its id. + - {assetList.map(x => ( - - - + {assetList.map((x) => ( + + + ))} ), parameters: { - backgrounds: { default: "debug" } - } -} + backgrounds: { values: [{ name: "debug", value: "#ccc" }] }, + }, +}; export const Default = { render: () => ( - + ), -} +}; diff --git a/frontend/src/app/main/ui/ds/storybook.cljs b/frontend/src/app/main/ui/ds/storybook.cljs index 3734f8410..322dbe822 100644 --- a/frontend/src/app/main/ui/ds/storybook.cljs +++ b/frontend/src/app/main/ui/ds/storybook.cljs @@ -24,6 +24,24 @@ (mf/defc story-grid* {::mf/props :obj} - [{:keys [children size]}] - [:article {:class (stl/css :story-grid) - :style (when (some? size) #js {"--component-grid-size" (dm/str size "px")})} children]) \ No newline at end of file + [{:keys [children size style] :rest other}] + (let [class (stl/css :story-grid) + size (or size 16) + style (or style {}) + style (mf/spread style :--component-grid-size (dm/str size "px")) + props (mf/spread-props other {:class class :style style})] + [:> "article" props children])) + +(mf/defc story-grid-cell* + {::mf/props :obj} + [{:keys [children] :rest other}] + (let [class (stl/css :story-grid-cell) + props (mf/spread-props other {:class class})] + [:> "article" props children])) + +(mf/defc story-header* + {::mf/props :obj} + [{:keys [children] :rest other}] + (let [class (stl/css :story-header) + props (mf/spread-props other {:class class})] + [:> "header" props children])) diff --git a/frontend/src/app/main/ui/ds/storybook.scss b/frontend/src/app/main/ui/ds/storybook.scss index edb36fdbb..6d09f0167 100644 --- a/frontend/src/app/main/ui/ds/storybook.scss +++ b/frontend/src/app/main/ui/ds/storybook.scss @@ -10,8 +10,12 @@ grid-template-columns: repeat(auto-fit, var(--component-grid-size, 16px)); gap: 1rem; color: var(--color-foreground-primary); - - & > * { - max-width: 100%; - } +} + +.story-grid-cell { + max-width: 100%; +} + +.story-header { + color: var(--color-foreground-primary); }
Hover on an icon to see its ID
Hover on a asset to see its id.