mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
✨ Revamp RawSvg stories and update prop name
This commit is contained in:
parent
7e61acc4da
commit
ba36023ae6
5 changed files with 61 additions and 46 deletions
|
@ -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 }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<StoryHeader>
|
||||
<h1>All Icons</h1>
|
||||
|
@ -55,7 +55,7 @@ export const All = {
|
|||
};
|
||||
|
||||
export const Default = {
|
||||
render: ({id, ...args}) => (
|
||||
render: ({ id, ...args }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Icon id={id} {...args} />
|
||||
</StoryWrapper>
|
||||
|
@ -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 }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Icon id={id} size={size} {...args} />
|
||||
</StoryWrapper>
|
||||
|
@ -77,6 +77,5 @@ export const CustomSize = {
|
|||
args: {
|
||||
id: "pin",
|
||||
size: "m",
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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)}]])
|
||||
|
|
|
@ -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: ({}) => (
|
||||
<StoryWrapper theme="light">
|
||||
<StoryHeader>
|
||||
<h1>All assets</h1>
|
||||
<p>Hover on a asset to see its id.</p>
|
||||
<h1>All SVG Assets</h1>
|
||||
<p>Hover on an asset to see its ID.</p>
|
||||
</StoryHeader>
|
||||
|
||||
<StoryGrid size="200">
|
||||
{assetList.map((x) => (
|
||||
<StoryGridCell key={x} title={x}>
|
||||
<RawSvg asset={x} style={{ maxWidth: "100%" }} />
|
||||
<RawSvg id={x} style={{ maxWidth: "100%" }} />
|
||||
</StoryGridCell>
|
||||
))}
|
||||
</StoryGrid>
|
||||
</StoryWrapper>
|
||||
),
|
||||
parameters: {
|
||||
controls: { exclude: ["id"] },
|
||||
backgrounds: { values: [{ name: "debug", value: "#ccc" }] },
|
||||
},
|
||||
};
|
||||
|
||||
export const Default = {
|
||||
render: () => (
|
||||
render: ({ id, ...args }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<RawSvg asset={svgs.BrandGitlab} width="200" />
|
||||
<RawSvg id={id} {...args} width="200" />
|
||||
</StoryWrapper>
|
||||
),
|
||||
args: {
|
||||
id: "brand-gitlab",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,13 +24,15 @@ export default {
|
|||
|
||||
export const AnyHeading = {
|
||||
name: "Heading",
|
||||
render: ({level, typography, ...args}) => (
|
||||
render: ({ level, typography, ...args }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Heading level={level} typography={typography} {...args}>Lorem ipsum</Heading>
|
||||
<Heading level={level} typography={typography} {...args}>
|
||||
Lorem ipsum
|
||||
</Heading>
|
||||
</StoryWrapper>
|
||||
),
|
||||
args: {
|
||||
level: 1,
|
||||
typography: "display",
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -14,29 +14,33 @@ export default {
|
|||
typography: {
|
||||
options: typographyIds,
|
||||
control: { type: "select" },
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const Default = {
|
||||
render: ({typography, ...args}) => (
|
||||
render: ({ typography, ...args }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Text typography={typography} {...args}>Lorem ipsum</Text>
|
||||
</StoryWrapper>
|
||||
),
|
||||
args: {
|
||||
typography: "display"
|
||||
}
|
||||
};
|
||||
|
||||
export const CustomTag = {
|
||||
render: ({typography, ...args}) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Text typography={typography} {...args}>Lorem ipsum</Text>
|
||||
<Text typography={typography} {...args}>
|
||||
Lorem ipsum
|
||||
</Text>
|
||||
</StoryWrapper>
|
||||
),
|
||||
args: {
|
||||
typography: "display",
|
||||
as: "li"
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export const CustomTag = {
|
||||
render: ({ typography, ...args }) => (
|
||||
<StoryWrapper theme="default">
|
||||
<Text typography={typography} {...args}>
|
||||
Lorem ipsum
|
||||
</Text>
|
||||
</StoryWrapper>
|
||||
),
|
||||
args: {
|
||||
typography: "display",
|
||||
as: "li",
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue