Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(header): wip #56

Merged
merged 10 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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>
10 changes: 9 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 Down
1 change: 1 addition & 0 deletions components/Molecules/NavElements/navMenus.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
gap: 2px;
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.2);
border-radius: 8px;
background-color: var(--white);
}
2 changes: 1 addition & 1 deletion components/Molecules/SearchBar/searchBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

input {
&::placeholder {
@apply text-grey-dark/75;
@apply text-grey-dark;
font-weight: 300;
}

Expand Down
2 changes: 2 additions & 0 deletions components/Molecules/UserMenuButton/UserMenuButton.stories.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import UserMenuButton from './UserMenuButton.twig';
import { userMenuButton } from './userMenuButton';

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

export const base = {
render: (args) => UserMenuButton(args),
play: () => userMenuButton(),
args: {
name: 'Bruce Wayne',
avatar: 'https://via.placeholder.com/150',
Expand Down
18 changes: 9 additions & 9 deletions components/Molecules/UserMenuButton/UserMenuButton.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<button class='UserMenuButton UserMenuButton--{{ variant }} {% if active %}UserMenuButton--active{% endif %}'>
<span class='UserMenuButton-avatar'>
<img src='{{ avatar }}' alt='{{ name }}' />
</span>
<span class='font-semibold UserMenuButton-name paragraph-3'>
{{ name }}
</span>
<span class='UserMenuButton-icon'>
{{ source('/icons/chevron-down.svg') }}
</span>
<span class='UserMenuButton-avatar'>
<img src='{{ avatar }}' alt='{{ name }}'/>
</span>
<span class='font-semibold UserMenuButton-name paragraph-3'>
{{ name }}
</span>
<span class='UserMenuButton-icon'>
{{ source('/icons/chevron-down.svg') }}
</span>
</button>
8 changes: 8 additions & 0 deletions components/Molecules/UserMenuButton/userMenuButton.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
outline: 2px solid var(--vermillon-medium);
}

&--active,
&:focus-visible,
&:focus-within {
.UserMenuButton-icon {
transform: rotate(180deg);
}
}

&-avatar {
img {
width: 40px;
Expand Down
17 changes: 17 additions & 0 deletions components/Molecules/UserMenuButton/userMenuButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const userMenuButton = () => {
const buttons = document.querySelectorAll('.UserMenuButton');

buttons.forEach((button) => {
button.addEventListener('click', (e) => {
button.classList.toggle('UserMenuButton--active');
});
});

window.addEventListener('click', (e) => {
if (!e.target.closest('.UserMenuButton')) {
buttons.forEach((button) => {
button.classList.remove('UserMenuButton--active');
});
}
});
};
14 changes: 14 additions & 0 deletions components/Organisms/Header/ConfigMenu.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ul class='Header-sidebar-items ConfigMenu'>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Paramètres système', iconLeft: "config", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Catalogue produit', iconLeft: "catalog", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Transport', iconLeft: "delivery", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Tunnel de commande', iconLeft: "checkout", variant: "md" } %}
</li>
</ul>
15 changes: 15 additions & 0 deletions components/Organisms/Header/Header.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { userMenuButton } from '../../Molecules/UserMenuButton/userMenuButton.js';
import Header from './Header.twig';
import { header } from './header.js';

export default {
title: 'Design System/Organisms/Header'
};

export const base = {
render: (args) => Header(args),
play: () => {
header();
userMenuButton();
}
};
43 changes: 43 additions & 0 deletions components/Organisms/Header/Header.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% include './HeaderNav.twig' %}
<nav class='Header'>
<div class='Header-left'>
<button class='Header-left-menu'>
{{ source('/icons/menu.svg') }}
</button>
<div class='Header-left-logo'>
{{ source('/images/placeholder-logo.svg') }}
</div>
</div>

<div class='Header-right'>

{% include '../../Molecules/Button/Button.twig' with { variant: 'secondary', icon_left: "search", classes: "Button--large ButtonSearch" } %}
{% include '../../Molecules/SearchBar/SearchBar.twig' with { size: 'lg' } %}
<button class='Header-searchbar-close'>
{{ source('/icons/close.svg') }}
</button>

<div class='Header-right-lang'>
{% include '../../Molecules/Button/Button.twig' with { variant: 'tertiary', text: 'FR', icon_left: "french", icon_right: "chevron-down", classes: "Button--large" } %}
<div class='Header-right-lang-menu'>
{% include '../../Molecules/NavElements/LanguageMenu.twig' %}
</div>
</div>

<div class='Header-right-config'>
{% include '../../Molecules/Button/Button.twig' with { variant: 'quartenary', icon_left: "config", classes: "Button--large" } %}
<div class='Header-right-config-menu'>
{% include '../../Molecules/NavElements/ConfigMenu.twig' %}
</div>
</div>

<div class='Header-right-user'>
{% include '../../Molecules/UserMenuButton/UserMenuButton.twig' with { name: 'Bruce Wayne', avatar: 'https://via.placeholder.com/150', variant: 'lg' } %}
<div class='Header-right-user-menu'>
{% include '../../Molecules/NavElements/UserMenu.twig' %}
</div>
</div>

{% include '../../Molecules/Button/Button.twig' with { variant: 'primary', icon_left: "eye", classes: "Button--large" } %}
</div>
</nav>
38 changes: 38 additions & 0 deletions components/Organisms/Header/HeaderNav.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<aside class='Header-sidebar'>
<button class='Header-sidebar-close Header-sidebar-close--withoutBack'>
{{ source('/icons/close.svg') }}
</button>

{% include '../../Molecules/Button/Button.twig' with { variant: 'tertiary', icon_left: "arrow-left", text: "Menu", classes: "Button--small Header-sidebar-back" } %}

<div class='Header-sidebar-content'>
<span class='Header-sidebar-title h2'>
Menu
</span>

{% include './SidebarMenu.twig' %}
{% include './LangMenu.twig' %}
{% include './ConfigMenu.twig' %}

{% include '../../Molecules/SearchBar/SearchBar.twig' with { size: 'lg', classes: "my-8" } %}

<div class="Header-sidebar-menus">
<div class="Header-sidebar-menus-lang">
{% include '../../Molecules/Button/Button.twig' with { variant: 'quartenary', icon_left: "french", text: "Langue", classes: "Button--xl" } %}
</div>

<div class="Header-sidebar-menus-config">
{% include '../../Molecules/Button/Button.twig' with { variant: 'quartenary', icon_left: "config", text: "Configuration", classes: "Button--xl" } %}
</div>

</div>
</div>


<div class='Header-sidebar-footer'>
<div class='Header-sidebar-footer-icon'>
{{ source('/images/thelia-black.svg') }}
</div>
<span class="font-light text-white/50 paragraph-4">V2.5.0</span>
</div>
</aside>
20 changes: 20 additions & 0 deletions components/Organisms/Header/LangMenu.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<ul class='Header-sidebar-items LangMenu'>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Français', iconLeft: "french", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'English', iconLeft: "english", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Español', iconLeft: "spanish", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Italiano', iconLeft: "italian", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Português', iconLeft: "portugese", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Deutsch', iconLeft: "german", variant: "md" } %}
</li>
</ul>
32 changes: 32 additions & 0 deletions components/Organisms/Header/SidebarMenu.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<ul class='Header-sidebar-items SidebarMenu SidebarMenu--open'>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Dashboard', iconLeft: "dashboard", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Commandes', iconLeft: "orders", iconRight: "long-arrow-right", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Clients', iconLeft: "clients", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Catalogue', iconLeft: "catalog", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Pages', iconLeft: "pages", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Blocks', iconLeft: "blocks", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Design', iconLeft: "design", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Outils', iconLeft: "tools", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Modules', iconLeft: "modules", variant: "md" } %}
</li>
<li class='Header-sidebar-item'>
{% include '../../Molecules/ChoiceCards/IconText/IconTextChoiceCard.twig' with { text: 'Aide', iconLeft: "tooltip", variant: "md" } %}
</li>
</ul>
Loading