Skip to content

Commit

Permalink
Merge branch 'develop' into feat/layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Neox63 authored Jul 18, 2024
2 parents 9d934a8 + 2e6f99d commit f934699
Show file tree
Hide file tree
Showing 37 changed files with 1,191 additions and 197 deletions.
1 change: 1 addition & 0 deletions components/Atoms/Colors/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"bg-vermillon-medium",
"bg-vermillon-light",
"bg-vermillon-lighter",
"bg-vermillon-lightest",
"bg-black",
"bg-grey-darker",
"bg-grey-dark",
Expand Down
33 changes: 33 additions & 0 deletions components/Molecules/Breadcrumb/Breadcrumb.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { breadcrumb } from './breadcrumb.js';
import Breadcrumb from './Breadcrumb.twig';

export default {
title: 'Design System/Molecules/Breadcrumb'
};

export const Base = {
render: (args) => Breadcrumb(args),
args: {
items: [
{ label: 'Page parante', href: '#' },
{ label: 'Page mère', href: '#' },
{ label: 'Page actuelle' }
]
}
};

export const Lengthy = {
render: (args) => Breadcrumb(args),
play: () => {
breadcrumb();
},
args: {
items: [
{ label: 'Non visible', href: '#' },
{ label: 'Non visible', href: '#' },
{ label: 'Page parante', href: '#' },
{ label: 'Page mère', href: '#' },
{ label: 'Page actuelle' }
]
}
};
28 changes: 28 additions & 0 deletions components/Molecules/Breadcrumb/Breadcrumb.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% set classes = classes|default('') %}
{% set items = items|default([]) %}

<nav class="Breadcrumb{{ classes }}" aria-label="Fil d'Ariane">
<ol class="Breadcrumb-list" itemscope itemtype="https://schema.org/BreadcrumbList">
{% if items.length > 3 %}
<li id="Breadcrumb-compressed" class="Breadcrumb-item Breadcrumb-item--isLink">
<button class="Breadcrumb-item-link Breadcrumb-compressed">...</button>
</li>
{% endif %}

{% for item in items %}
<li class="Breadcrumb-item paragraph-3{% if item.href %} Breadcrumb-item--isLink{% endif %}{% if loop.index <= (items.length - 3) %} hide{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
{% if item.href %}
<a class="Breadcrumb-item-link" href="{{ item.href }}" itemprop="item">
<span itemprop="name">{{ item.label }}</span>
</a>
<meta itemprop="position" content="{{ loop.index + 1 }}"/>
{% else %}
<span itemprop="name" aria-current="page">
{{ item.label }}
</span>
<meta itemprop="position" content="{{ loop.index + 1 }}"/>
{% endif %}
</li>
{% endfor %}
</ol>
</nav>
14 changes: 14 additions & 0 deletions components/Molecules/Breadcrumb/breadcrumb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const breadcrumb = () => {
const btnCompressed = document.querySelector('.Breadcrumb-compressed');
const liCompressed = document.getElementById('Breadcrumb-compressed');
const items = document.querySelectorAll('.Breadcrumb-item');

if (btnCompressed) {
btnCompressed.addEventListener('click', function () {
items.forEach(function (item) {
item.classList.remove('hide');
});
liCompressed.classList.add('hide');
});
}
};
58 changes: 58 additions & 0 deletions components/Molecules/Breadcrumb/paragraph.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.Breadcrumb {
&-list {
display: flex;
flex-wrap: wrap;
gap: rem-convert(8px);
align-items: center;
}

&-item {
color: var(--black);
display: flex;
gap: rem-convert(8px);

&--isLink {
&::after {
content: '/';
font-size: rem-convert(10px);
}
}

&-link {
outline: none;
text-decoration: underline;

a&:hover {
color: var(--grey);
}

&:focus-visible {
background-color: var(--vermillon-light);
}
}
}

&-compressed {
background-color: var(--grey-lightest);
width: rem-convert(16px);
height: rem-convert(16px);
display: inline-flex;
justify-content: center;
line-height: rem-convert(8px);
text-decoration: none;
margin-top: rem-convert(2px);

&:focus-visible {
background-color: var(--grey-lightest);
border: solid 1px var(--vermillon-medium);
}

&:hover {
background-color: var(--vermillon-lightest);
}
}

.hide {
display: none;
}
}
8 changes: 6 additions & 2 deletions components/Molecules/Button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
width: 100%;

& > span.icon {
@apply w-5 h-5;
width: 22px;
height: 22px;

&-left:not(:only-child) {
margin-right: rem-convert(16px);
}
Expand All @@ -38,7 +40,9 @@
&--medium,
&--large {
& > span.icon {
@apply w-5 h-5;
width: 22px;
height: 22px;

&-left:not(:only-child) {
margin-right: rem-convert(8px);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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',
name: 'checkbox',
checked: false
},
argTypes: {
size: {
control: { type: 'select' },
options: ['sm', 'lg']
},
text: {
control: { type: 'text' }
},
disabled: {
control: { type: 'boolean' }
},
description: {
control: { type: 'text' }
}
}
};
15 changes: 15 additions & 0 deletions components/Molecules/ChoiceCards/Checkbox/CheckboxChoiceCard.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% set choiceCardClasses = 'ChoiceCard ChoiceCard--' ~ size %}
{% if checked %}
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--active' %}
{% endif %}
{% if disabled %}
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--disabled' %}
{% endif %}

<div class="{{ choiceCardClasses }}">
{% include '../../Form/Checkbox.twig' with { label: text, name: name, disabled: disabled, checked: checked, classes: "inChoiceCard" } %}

{% if description and size == "lg" %}
<p class="ChoiceCard-description paragraph-4">{{ description }}</p>
{% endif %}
</div>
28 changes: 14 additions & 14 deletions components/Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<button class='IconTextChoiceCard IconTextChoiceCard--{{ variant }} {% if not iconLeft and iconRight %}justify-between{% endif %}' {% if disabled %}disabled{% endif %}>
{% if iconLeft %}
<span class='IconTextChoiceCard-icon'>
{{ source('/icons/' ~ iconLeft ~ '.svg') }}
</span>
{% endif %}
{% if text %}
<span class='IconTextChoiceCard-text paragraph-3'>{{ text }}</span>
{% endif %}
{% if iconRight %}
<span class='IconTextChoiceCard-icon'>
{{ source('/icons/' ~ iconRight ~ '.svg') }}
</span>
{% endif %}
<button class='IconTextChoiceCard IconTextChoiceCard--{{ variant }} {% if not iconLeft and iconRight %}justify-between{% endif %}' {% if disabled %} disabled {% endif %}>
{% if iconLeft %}
<span class='IconTextChoiceCard-icon IconTextChoiceCard-iconLeft'>
{{ source('/icons/' ~ iconLeft ~ '.svg') }}
</span>
{% endif %}
{% if text %}
<span class='IconTextChoiceCard-text paragraph-3'>{{ text }}</span>
{% endif %}
{% if iconRight %}
<span class='IconTextChoiceCard-icon IconTextChoiceCard-iconRight'>
{{ source('/icons/' ~ iconRight ~ '.svg') }}
</span>
{% endif %}
</button>
32 changes: 32 additions & 0 deletions components/Molecules/ChoiceCards/Radio/RadioChoiceCard.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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',
name: 'radio',
checked: false
},
argTypes: {
size: {
control: { type: 'select' },
options: ['sm', 'lg']
},
text: {
control: { type: 'text' }
},
disabled: {
control: { type: 'boolean' }
},
description: {
control: { type: 'text' }
}
}
};
15 changes: 15 additions & 0 deletions components/Molecules/ChoiceCards/Radio/RadioChoiceCard.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% set choiceCardClasses = 'ChoiceCard ChoiceCard--' ~ size %}
{% if checked %}
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--active' %}
{% endif %}
{% if disabled %}
{% set choiceCardClasses = choiceCardClasses ~ ' ChoiceCard--disabled' %}
{% endif %}

<div class="{{ choiceCardClasses }}">
{% include '../../Form/Radio.twig' with { label: text, name: name, disabled: disabled, checked: checked, classes: "inChoiceCard" } %}

{% if description and size == "lg" %}
<p class="ChoiceCard-description paragraph-4">{{ description }}</p>
{% endif %}
</div>
56 changes: 55 additions & 1 deletion components/Molecules/ChoiceCards/choiceCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@
border-radius: 8px;
background-color: var(--white);
min-width: rem-convert(130px);
width: 100%;
cursor: pointer;
outline-offset: -2px;

&-iconRight {
margin-left: auto;
}

&--md {
border-radius: 0px;
border-bottom: 1px solid var(--grey-lighter);
padding-top: 25px;
padding-bottom: 25px;

&:focus-visible {
border-bottom: 0px;
border-color: transparent;
}
}

Expand All @@ -36,3 +44,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);
}
}
}
2 changes: 1 addition & 1 deletion components/Molecules/Form/Checkbox.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<label class="Checkbox {{ classes|default('') }} {{ error ? 'error' : ''}}" for='{{ name }}'>
<input type="checkbox" name='{{ name }}' value='{{ value }}' {% if disabled %} disabled {% endif %} {% if checked %} checked {% endif %}>
<input type="checkbox" name='{{ name }}' {% if disabled %} disabled {% endif %} {% if checked %} checked {% endif %}>
<div class="flex items-center justify-center checkmark">
<span class="w-[16px] h-[16px] text-white">{{ source("/icons/check.svg") }}</span>
</div>
Expand Down
Loading

0 comments on commit f934699

Please sign in to comment.