Skip to content

Commit 0d8c596

Browse files
committed
docs(Icon): Add Icon.vue MDX docs
1 parent 9f1771d commit 0d8c596

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

src/components/Icon/Icon.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Meta, Title, Story, Source, DocsStory } from '@storybook/blocks';
2+
import * as IconStories from './Icon.stories';
3+
4+
<Meta title="Components/Icon" of={IconStories} />
5+
6+
<Title>Icon</Title>
7+
8+
```ts
9+
import Icon from '@jackdomleo7/vue3-library/components/Icon/Icon.vue';
10+
```
11+
12+
Render an inline SVG.
13+
14+
## Decorative
15+
16+
Render a decorative icon with no semantic meaning. This is useful for icons that are purely decorative and do not convey any information to the user.
17+
18+
<DocsStory of={IconStories.Decorative} />
19+
20+
## Informative
21+
22+
Render an informative icon with semantic meaning. This is useful for icons that convey information to the user, such as a warning or error icon. This will render an `aria-label` attribute to describe the icon to assistive technologies.
23+
24+
<DocsStory of={IconStories.Informative} />

src/components/Icon/Icon.stories.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import Icon from './Icon.vue';
44

55
const meta = {
66
title: 'Components/Icon',
7-
component: Icon
7+
component: Icon,
8+
render: (args) => ({
9+
components: { Icon },
10+
setup() {
11+
return { args };
12+
},
13+
template: '<Icon v-bind="args" style="max-width: 4rem;" />'
14+
})
815
} satisfies Meta<typeof Icon>;
916

1017
export default meta;
@@ -21,8 +28,8 @@ export const Decorative: Story = {
2128
export const Informative: Story = {
2229
args: {
2330
icon: {
24-
src: new URL('@/docs/assets/ChevronRight.svg', import.meta.url).href,
25-
label: 'ChevronRight'
31+
src: new URL('@/docs/assets/ErrorExclamation.svg', import.meta.url).href,
32+
label: 'Error'
2633
}
2734
}
2835
};
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)