From ad36284a73f91fb51989380783002fd304250467 Mon Sep 17 00:00:00 2001 From: Alexandre Morgaut <49318+AMorgaut@users.noreply.github.com> Date: Sat, 15 Jun 2024 01:07:10 +0200 Subject: [PATCH] feat: add button qnd button group components --- src/App.vue | 2 + .../Atoms/ButtonItem/ButtonItem.spec.js | 11 ++++++ .../Atoms/ButtonItem/ButtonItem.stories.js | 22 +++++++++++ .../Atoms/ButtonItem/ButtonItem.vue | 39 +++++++++++++++++++ .../BoutonGroup/ButtonGroup.stories.js | 22 +++++++++++ .../Mollecules/BoutonGroup/ButtonGroup.vue | 34 ++++++++++++++++ 6 files changed, 130 insertions(+) create mode 100644 src/components/Atoms/ButtonItem/ButtonItem.spec.js create mode 100644 src/components/Atoms/ButtonItem/ButtonItem.stories.js create mode 100644 src/components/Atoms/ButtonItem/ButtonItem.vue create mode 100644 src/components/Mollecules/BoutonGroup/ButtonGroup.stories.js create mode 100644 src/components/Mollecules/BoutonGroup/ButtonGroup.vue diff --git a/src/App.vue b/src/App.vue index a595cfd..68dc3ca 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,7 @@ @@ -11,6 +12,7 @@ import RuleIconTag from './components/Mollecules/RuleIconTag/RuleIconTag.vue'
+ mon bouton
diff --git a/src/components/Atoms/ButtonItem/ButtonItem.spec.js b/src/components/Atoms/ButtonItem/ButtonItem.spec.js new file mode 100644 index 0000000..6f9dcce --- /dev/null +++ b/src/components/Atoms/ButtonItem/ButtonItem.spec.js @@ -0,0 +1,11 @@ +import { describe, it, expect } from 'vitest' + +import { mount } from '@vue/test-utils' +import ButtonItem from './ButtonItem.vue' + +describe('ButtonItem', () => { + it('renders properly', () => { + const wrapper = mount(ButtonItem, { props: { label: 'click me' } }) + expect(wrapper.text()).toContain('click me') + }) +}) diff --git a/src/components/Atoms/ButtonItem/ButtonItem.stories.js b/src/components/Atoms/ButtonItem/ButtonItem.stories.js new file mode 100644 index 0000000..6ba81da --- /dev/null +++ b/src/components/Atoms/ButtonItem/ButtonItem.stories.js @@ -0,0 +1,22 @@ +import ButtonItem from './ButtonItem.vue' + +export default { + title: 'Atoms/Button', + component: ButtonItem, + tags: ['autodocs'], + argTypes: { + default: { control: 'text', default: 'click me' }, + type: { + control: { type: 'inline-radio' }, + options: ['standard', 'primary'], + default: 'standard' + } + } +} + +export const StandardButton = { + args: { default: 'click me', type: 'standard' } +} +export const PrimaryButton = { + args: { default: 'click me', type: 'primary' } +} diff --git a/src/components/Atoms/ButtonItem/ButtonItem.vue b/src/components/Atoms/ButtonItem/ButtonItem.vue new file mode 100644 index 0000000..f172ec8 --- /dev/null +++ b/src/components/Atoms/ButtonItem/ButtonItem.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/components/Mollecules/BoutonGroup/ButtonGroup.stories.js b/src/components/Mollecules/BoutonGroup/ButtonGroup.stories.js new file mode 100644 index 0000000..915fe03 --- /dev/null +++ b/src/components/Mollecules/BoutonGroup/ButtonGroup.stories.js @@ -0,0 +1,22 @@ +import ButtonGroup from './ButtonGroup.vue' + +export default { + title: 'Mollecules/Button Group', + component: ButtonGroup, + tags: ['autodocs'], + argTypes: { + buttons: { + control: { type: 'object' } + } + } +} + +export const StandardButtonGroup = { + args: { + buttons: [ + { label: 'submit', type: 'primary' }, + { label: 'reset' }, + { label: 'cancel', type: 'standard' } + ] + } +} diff --git a/src/components/Mollecules/BoutonGroup/ButtonGroup.vue b/src/components/Mollecules/BoutonGroup/ButtonGroup.vue new file mode 100644 index 0000000..e8671f1 --- /dev/null +++ b/src/components/Mollecules/BoutonGroup/ButtonGroup.vue @@ -0,0 +1,34 @@ + + + + +