diff --git a/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.stories.js b/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.stories.js new file mode 100644 index 0000000..a6d6eed --- /dev/null +++ b/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.stories.js @@ -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' } + } + } +}; diff --git a/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.twig b/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.twig new file mode 100644 index 0000000..5698abb --- /dev/null +++ b/components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.twig @@ -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 %} + +
+ {% include '../../Form/Checkbox.twig' with { label: text } %} + + {% if description and size == "lg" %} +

{{ description }}

+ {% endif %} +
diff --git a/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.stories.js b/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.stories.js new file mode 100644 index 0000000..9eaf0f4 --- /dev/null +++ b/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.stories.js @@ -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' } + } + } +}; diff --git a/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.twig b/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.twig new file mode 100644 index 0000000..b8ec83f --- /dev/null +++ b/components/Molecules/ChoiceCards/Radio/RadioChoiceCard.twig @@ -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 %} + +
+ {% include '../../Form/Radio.twig' with { label: text } %} + + {% if description and size == "lg" %} +

{{ description }}

+ {% endif %} +
diff --git a/components/Molecules/ChoiceCards/choiceCard.css b/components/Molecules/ChoiceCards/choiceCard.css index 75933d5..71db21f 100644 --- a/components/Molecules/ChoiceCards/choiceCard.css +++ b/components/Molecules/ChoiceCards/choiceCard.css @@ -36,3 +36,49 @@ height: 22px; } } + +.ChoiceCard { + display: flex; + flex-direction: column; + padding: 16px 24px 16px 16px; + gap: 8px; + border-radius: 8px; + outline: 1px solid var(--grey); + width: max-content; + + &-description { + margin-left: 25px; + } + + &:hover { + background: var(--vermillon-lightest); + outline-color: var(--vermillon-medium); + } + + &:focus-within { + outline: 2px solid var(--vermillon-medium); + } + + &--active { + background: var(--vermillon-lighter); + outline-color: var(--vermillon-medium); + + &:focus-within { + outline: 2px solid var(--vermillon); + } + } + + &:disabled, + &[disabled], + &--disabled { + color: var(--grey-lighter); + outline-color: var(--grey-lighter); + background-color: var(--white); + cursor: not-allowed; + + &:hover { + background-color: var(--white); + outline-color: var(--grey-lighter); + } + } +}