From ba36023ae6674c2d22e739a7c216ce74d4a92b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 10 Jul 2024 16:30:01 +0200 Subject: [PATCH] :sparkles: Revamp RawSvg stories and update prop name --- .../ui/ds/foundations/assets/icon.stories.jsx | 21 +++++----- .../ui/ds/foundations/assets/raw_svg.cljs | 4 +- .../ds/foundations/assets/raw_svg.stories.jsx | 34 ++++++++++------ .../typography/heading.stories.jsx | 8 ++-- .../foundations/typography/text.stories.jsx | 40 ++++++++++--------- 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/frontend/src/app/main/ui/ds/foundations/assets/icon.stories.jsx b/frontend/src/app/main/ui/ds/foundations/assets/icon.stories.jsx index 8cd62c291..c6b93f266 100644 --- a/frontend/src/app/main/ui/ds/foundations/assets/icon.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/assets/icon.stories.jsx @@ -16,17 +16,17 @@ export default { argTypes: { id: { options: iconList, - control: { type: "select" } + control: { type: "select" }, }, size: { options: ["m", "s"], - control: { type: "radio" } - } - } + control: { type: "radio" }, + }, + }, }; export const All = { - render: ({size}) => ( + render: ({ size }) => (

All Icons

@@ -55,7 +55,7 @@ export const All = { }; export const Default = { - render: ({id, ...args}) => ( + render: ({ id, ...args }) => ( @@ -64,12 +64,12 @@ export const Default = { id: "pin", }, parameters: { - controls: { exclude: ["size"] } - } + controls: { exclude: ["size"] }, + }, }; export const CustomSize = { - render: ({id, size, ...args}) => ( + render: ({ id, size, ...args }) => ( @@ -77,6 +77,5 @@ export const CustomSize = { args: { id: "pin", size: "m", - } + }, }; - diff --git a/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.cljs b/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.cljs index f6e09ad9f..afc691f1f 100644 --- a/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.cljs +++ b/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.cljs @@ -32,6 +32,6 @@ (mf/defc raw-svg* {::mf/props :obj} - [{:keys [asset] :rest props}] + [{:keys [id] :rest props}] [:> "svg" props - [:use {:href (dm/str "#asset-" asset)}]]) + [:use {:href (dm/str "#asset-" id)}]]) diff --git a/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.stories.jsx b/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.stories.jsx index b73e6b56e..dcdf6e509 100644 --- a/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/assets/raw_svg.stories.jsx @@ -6,41 +6,51 @@ const { StoryWrapper, StoryGrid, StoryGridCell, StoryHeader } = Components.storybook; const { svgs } = Components.meta; -export default { - title: "Foundations/RawSvg", - component: Components.RawSvg, -}; - const assetList = Object.entries(svgs) .map(([_, value]) => value) .sort(); -export const AllAssets = { - render: () => ( +export default { + title: "Foundations/Assets/RawSvg", + component: Components.RawSvg, + argTypes: { + id: { + options: assetList, + control: { type: "select" }, + }, + }, +}; + +export const All = { + render: ({}) => ( -

All assets

-

Hover on a asset to see its id.

+

All SVG Assets

+

Hover on an asset to see its ID.

{assetList.map((x) => ( - + ))}
), parameters: { + controls: { exclude: ["id"] }, backgrounds: { values: [{ name: "debug", value: "#ccc" }] }, }, }; export const Default = { - render: () => ( + render: ({ id, ...args }) => ( - + ), + args: { + id: "brand-gitlab", + }, }; diff --git a/frontend/src/app/main/ui/ds/foundations/typography/heading.stories.jsx b/frontend/src/app/main/ui/ds/foundations/typography/heading.stories.jsx index 28336b90f..30e592e88 100644 --- a/frontend/src/app/main/ui/ds/foundations/typography/heading.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/typography/heading.stories.jsx @@ -24,13 +24,15 @@ export default { export const AnyHeading = { name: "Heading", - render: ({level, typography, ...args}) => ( + render: ({ level, typography, ...args }) => ( - Lorem ipsum + + Lorem ipsum + ), args: { level: 1, typography: "display", - } + }, }; diff --git a/frontend/src/app/main/ui/ds/foundations/typography/text.stories.jsx b/frontend/src/app/main/ui/ds/foundations/typography/text.stories.jsx index 31cceaa5d..1eaec1b8e 100644 --- a/frontend/src/app/main/ui/ds/foundations/typography/text.stories.jsx +++ b/frontend/src/app/main/ui/ds/foundations/typography/text.stories.jsx @@ -14,29 +14,33 @@ export default { typography: { options: typographyIds, control: { type: "select" }, - } - } + }, + }, }; export const Default = { - render: ({typography, ...args}) => ( + render: ({ typography, ...args }) => ( - Lorem ipsum - - ), - args: { - typography: "display" - } -}; - -export const CustomTag = { - render: ({typography, ...args}) => ( - - Lorem ipsum + + Lorem ipsum + ), args: { typography: "display", - as: "li" - } -} + }, +}; + +export const CustomTag = { + render: ({ typography, ...args }) => ( + + + Lorem ipsum + + + ), + args: { + typography: "display", + as: "li", + }, +};