-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
532c4de
commit 062f74e
Showing
3 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
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,26 @@ | ||
import SnackBar from './SnackBar.twig'; | ||
|
||
export default { | ||
title: 'Design System/Organisms/SnackBar' | ||
}; | ||
|
||
export const base = { | ||
render: (args) => SnackBar(args), | ||
args: { | ||
size: 'small', | ||
variant: 'error', | ||
button: 'Bouton', | ||
text: 'Ici un message d’erreur pour aider l’utilisateur à corriger son erreur.', | ||
withIcon: true | ||
}, | ||
argTypes: { | ||
size: { | ||
options: ['small', 'large'], | ||
control: { type: 'radio' } | ||
}, | ||
variant: { | ||
options: ['error', 'warning', 'validated', 'informative', 'neutral-light', 'neutral-dark'], | ||
control: { type: 'radio' } | ||
}, | ||
} | ||
}; |
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,20 @@ | ||
{% set icon = '' %} | ||
{% if variant|default('theme-light') == 'error' %}{% set icon = 'error' %}{% endif %} | ||
{% if variant|default('theme-light') == 'warning' %}{% set icon = 'warning' %}{% endif %} | ||
{% if variant|default('theme-light') == 'validated' %}{% set icon = 'check' %}{% endif %} | ||
{% if variant|default('theme-light') == 'informative' %}{% set icon = 'info' %}{% endif %} | ||
|
||
<div class='SnackBar SnackBar-{{ size|default('small') }} SnackBar--{{ variant|default('theme-light') }}'> | ||
<div class='SnackBar-content'> | ||
{% if withIcon and icon %} | ||
<div class='SnackBar-icon'>{{ source("/icons/" ~ icon ~".svg") }}</div> | ||
{% endif %} | ||
<div class='SnackBar-message'>{{ text }}</div> | ||
</div> | ||
{% if button %} | ||
<div class='SnackBar-button'> | ||
{% include '../../Molecules/Button/Button.twig' with | ||
{classes:'', variant:'secondary', text:button} %} | ||
</div> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.SnackBar { | ||
border-radius: 8px; | ||
border: 1px solid var(--black); | ||
padding-bottom: rem-convert(20px); | ||
padding-top: rem-convert(20px); | ||
&-content { | ||
display: flex; | ||
} | ||
&-icon { | ||
width: rem-convert(20px); | ||
height: rem-convert(20px); | ||
margin-right: rem-convert(8px); | ||
flex-shrink: 0; | ||
} | ||
&-small { | ||
width: rem-convert(334px); | ||
padding-right: rem-convert(30px); | ||
padding-left: rem-convert(24px); | ||
|
||
.SnackBar-button { | ||
margin-top: rem-convert(10px); | ||
} | ||
} | ||
&-large { | ||
display: flex; | ||
gap: 10px; | ||
width: rem-convert(661px); | ||
padding-right: rem-convert(24px); | ||
padding-left: rem-convert(24px); | ||
} | ||
|
||
|
||
&--neutral-light { | ||
background: var(--theme-lightest); | ||
border-color: var(--theme-medium); | ||
} | ||
&--neutral-dark { | ||
background: var(--theme-light); | ||
border-color: var(--theme-medium); | ||
} | ||
|
||
&--error { | ||
background: var(--error-lightest); | ||
border-color: var(--error); | ||
} | ||
&--warning { | ||
background: var(--warning-lightest); | ||
border-color: var(--warning); | ||
} | ||
&--validated { | ||
background: var(--validated-lightest); | ||
border-color: var(--validated); | ||
} | ||
&--informative { | ||
background: var(--informative-lightest); | ||
border-color: var(--informative); | ||
} | ||
} |