diff --git a/src/components/Button/Button.stories.mdx b/src/components/Button/Button.stories.mdx index da61946..959374a 100644 --- a/src/components/Button/Button.stories.mdx +++ b/src/components/Button/Button.stories.mdx @@ -1,6 +1,8 @@ import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs'; import Button from './Button.vue'; +import IconList from '../Shared/IconList.js'; +export const icons = Object.keys(IconList.solid); @@ -78,6 +91,7 @@ export const Default = ({ slot1, slot2, ...rest }) => { argTypes={{ ...Default.argTypes }} args={{ variant: 'primary', + icon: 'PlusCircleIcon', slot1: 'Primary', }} > diff --git a/src/components/Button/Button.vue b/src/components/Button/Button.vue index 041227b..6db896b 100644 --- a/src/components/Button/Button.vue +++ b/src/components/Button/Button.vue @@ -1,13 +1,22 @@ - - diff --git a/src/components/Icon/Icon.stories.mdx b/src/components/Icon/Icon.stories.mdx new file mode 100644 index 0000000..4350f14 --- /dev/null +++ b/src/components/Icon/Icon.stories.mdx @@ -0,0 +1,66 @@ +import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs'; + +import Icon from './Icon.vue'; +import IconList from '../Shared/IconList.js'; +export const icons = Object.keys(IconList.solid); + + + +export const Default = (args) => { + return { + components: { Icon }, + setup() { + return { args }; + }, + template: ``, + }; +}; + +# Default + + + + {Default.bind({})} + + + +# Reference + + diff --git a/src/components/Icon/Icon.vue b/src/components/Icon/Icon.vue new file mode 100644 index 0000000..39f8d9c --- /dev/null +++ b/src/components/Icon/Icon.vue @@ -0,0 +1,35 @@ + + diff --git a/src/components/Icon/__snapshots__/icon.spec.ts.snap b/src/components/Icon/__snapshots__/icon.spec.ts.snap new file mode 100644 index 0000000..0989904 --- /dev/null +++ b/src/components/Icon/__snapshots__/icon.spec.ts.snap @@ -0,0 +1,15 @@ +// Vitest Snapshot v1 + +exports[`Icon > renders properly 1`] = ` + +`; diff --git a/src/components/Icon/icon.spec.ts b/src/components/Icon/icon.spec.ts new file mode 100644 index 0000000..f563e87 --- /dev/null +++ b/src/components/Icon/icon.spec.ts @@ -0,0 +1,28 @@ +import { describe, it, expect } from 'vitest'; + +import { mount } from '@vue/test-utils'; +import Icon from './Icon.vue'; + +describe('Icon', () => { + it('renders properly', () => { + const wrapper = mount(Icon, { + props: { + name: 'AdjustmentsIcon', + size: '24', + color: 'rgb(255, 255, 255)', + kind: 'solid', + }, + }); + expect(wrapper.exists()).toBe(true); + expect(wrapper.find('svg').exists()).toBe(true); + expect(wrapper.find('svg').element.getAttribute('aria-hidden')).toBe( + 'true' + ); + expect(wrapper.find('svg').element.getAttribute('style')).toBe( + 'color: rgb(255, 255, 255);' + ); + expect(wrapper.find('svg').element.getAttribute('fill')).toBe( + 'currentColor' + ); + }); +}); diff --git a/src/components/Shared/Enums.ts b/src/components/Shared/Enums.ts new file mode 100644 index 0000000..c6e5cba --- /dev/null +++ b/src/components/Shared/Enums.ts @@ -0,0 +1,12 @@ +export enum IconKind { + Solid = 'solid', + Outline = 'outline', +} + +export enum IconSize { + XSmall = '20', + Small = '24', + Medium = '32', + Large = '40', + XLarge = '48', +} diff --git a/src/components/Shared/IconList.js b/src/components/Shared/IconList.js new file mode 100644 index 0000000..feac7d3 --- /dev/null +++ b/src/components/Shared/IconList.js @@ -0,0 +1,6 @@ +import solid from '@heroicons/vue/solid/index.js'; +import outline from '@heroicons/vue/outline/index.js'; +export default { + solid, + outline, +}; diff --git a/src/components/icons/IconCommunity.vue b/src/components/icons/IconCommunity.vue deleted file mode 100644 index 2dc8b05..0000000 --- a/src/components/icons/IconCommunity.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconDocumentation.vue b/src/components/icons/IconDocumentation.vue deleted file mode 100644 index 6d4791c..0000000 --- a/src/components/icons/IconDocumentation.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconEcosystem.vue b/src/components/icons/IconEcosystem.vue deleted file mode 100644 index c3a4f07..0000000 --- a/src/components/icons/IconEcosystem.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconSupport.vue b/src/components/icons/IconSupport.vue deleted file mode 100644 index 7452834..0000000 --- a/src/components/icons/IconSupport.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconTooling.vue b/src/components/icons/IconTooling.vue deleted file mode 100644 index 660598d..0000000 --- a/src/components/icons/IconTooling.vue +++ /dev/null @@ -1,19 +0,0 @@ - -