Skip to content

Commit

Permalink
Fix Storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Apr 18, 2023
1 parent 9091f0e commit 21225a5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/nuxt.config.ts
Expand Up @@ -293,6 +293,13 @@ const config: NuxtConfig = {
viewports: VIEWPORTS,
},
},
modules: {
// with upgraded storybook, svg-sprite is crashing the storybook build.
// It's not clear why that is, because it should have been fixed in
// svg-sprite 0.5.1: https://github.com/nuxt-community/storybook/issues/155
// That doesn't seem to have worked, however.
exclude: ["svg-sprite"],
},
},
proxy: {
// The key is appended to the address in the value.
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/components/VIcon/meta/VIcon.stories.mdx
Expand Up @@ -8,8 +8,17 @@ import {

import VIcon from "~/components/VIcon/VIcon.vue"

import spriteData from "~/assets/icons/sprite/sprites.json"

<Meta title="Components/VIcon" component={VIcon} />

export const iconNames = spriteData.reduce((accumulator, sprite) => {
const iconsWithNamespace = sprite.symbols.map((symbol) =>
sprite.defaultSprite ? symbol : `${sprite.name}/${symbol}`
)
return accumulator.concat(iconsWithNamespace)
}, [])

export const Template = (args) => ({
template: `<VIcon v-bind="args" />`,
components: { VIcon },
Expand All @@ -36,6 +45,13 @@ To display the icon, pass the name of the icon as a prop.
args={{
name: "replay",
}}
argTypes={{
name: {
options: iconNames,
control: { type: "select" },
defaultValue: "replay",
},
}}
>
{Template.bind({})}
</Story>
Expand Down

0 comments on commit 21225a5

Please sign in to comment.