-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(choice-cards): radio and checkbox variants
- Loading branch information
1 parent
4b5b26c
commit 279bbaf
Showing
5 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import CheckBoxChoiceCard from './CheckboxChoiceCard.twig'; | ||
|
||
export default { | ||
title: 'Design System/Molecules/ChoiceCards/CheckboxChoiceCard' | ||
}; | ||
|
||
export const base = { | ||
render: (args) => CheckBoxChoiceCard(args), | ||
args: { | ||
text: 'Label', | ||
size: 'sm', | ||
disabled: false, | ||
description: 'ici une courte description', | ||
active: false | ||
}, | ||
argTypes: { | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['sm', 'lg'] | ||
}, | ||
text: { | ||
control: { type: 'text' } | ||
}, | ||
disabled: { | ||
control: { type: 'boolean' } | ||
}, | ||
description: { | ||
control: { type: 'text' } | ||
}, | ||
active: { | ||
control: { type: 'boolean' } | ||
} | ||
} | ||
}; |
15 changes: 15 additions & 0 deletions
15
components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% set choiceCardClasses = 'ChoiceCard ChoiceCard--' ~ size %} | ||
{% if active %} | ||
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--active' %} | ||
{% endif %} | ||
{% if disabled %} | ||
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--disabled' %} | ||
{% endif %} | ||
|
||
<div class="{{ choiceCardClasses }}"> | ||
{% include '../../Form/Checkbox.twig' with { label: text } %} | ||
|
||
{% if description and size == "lg" %} | ||
<p class="ChoiceCard-description paragraph-4">{{ description }}</p> | ||
{% endif %} | ||
</div> |
34 changes: 34 additions & 0 deletions
34
components/Molecules/ChoiceCards/Radio/RadioChoiceCard.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import RadioChoiceCard from './RadioChoiceCard.twig'; | ||
|
||
export default { | ||
title: 'Design System/Molecules/ChoiceCards/RadioChoiceCard' | ||
}; | ||
|
||
export const base = { | ||
render: (args) => RadioChoiceCard(args), | ||
args: { | ||
text: 'Label', | ||
size: 'sm', | ||
disabled: false, | ||
description: 'ici une courte description', | ||
active: false | ||
}, | ||
argTypes: { | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['sm', 'lg'] | ||
}, | ||
text: { | ||
control: { type: 'text' } | ||
}, | ||
disabled: { | ||
control: { type: 'boolean' } | ||
}, | ||
description: { | ||
control: { type: 'text' } | ||
}, | ||
active: { | ||
control: { type: 'boolean' } | ||
} | ||
} | ||
}; |
15 changes: 15 additions & 0 deletions
15
components/Molecules/ChoiceCards/Radio/RadioChoiceCard.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% set choiceCardClasses = 'ChoiceCard ChoiceCard--' ~ size %} | ||
{% if active %} | ||
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--active' %} | ||
{% endif %} | ||
{% if disabled %} | ||
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--disabled' %} | ||
{% endif %} | ||
|
||
<div class="{{ choiceCardClasses }}"> | ||
{% include '../../Form/Radio.twig' with { label: text } %} | ||
|
||
{% if description and size == "lg" %} | ||
<p class="ChoiceCard-description paragraph-4">{{ description }}</p> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters