Skip to content

Commit

Permalink
feat: add a PixAppLayout component
Browse files Browse the repository at this point in the history
Co-authored-by: mache <[email protected]>
Co-authored-by: lionelb <[email protected]>
  • Loading branch information
3 people committed Nov 7, 2024
1 parent a2ad2cc commit 654fcbc
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 33 deletions.
3 changes: 3 additions & 0 deletions addon/components/pix-app-layout.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="pix-app-layout">
{{yield}}
</div>
6 changes: 6 additions & 0 deletions addon/styles/_pix-app-layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.pix-app-layout{
display: grid;
grid-template-columns: minmax(214px, auto) 1fr;
gap: var(--pix-spacing-4x);
padding: var(--pix-spacing-4x);
}
1 change: 1 addition & 0 deletions addon/styles/addon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@import 'trap-focus';
@import 'pix-search-input';
@import 'pix-navigation';
@import 'pix-app-layout';


// at the end so it can override it's children scss
Expand Down
1 change: 1 addition & 0 deletions app/components/pix-app-layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@1024pix/pix-ui/components/pix-app-layout';
74 changes: 41 additions & 33 deletions app/stories/pix-navigation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,52 @@ Le composant `<PixNavigation/>` comporte 3 placeholders
- `<:navElements>` permet d'afficher les boutons de navigation
- `<:footer>` permet d'afficher des infos et d'autres boutons (selecteur d'orga, déconnexion)

Ce composant doit être utiliser avec le composant `<PixAppLayout>` afin de pouvoir occupé tout la hauteur de la page et être toujours visible.

En complément, les composants `<PixNavigationButton/>` et `<PixNavigationSeparator/>` permette de composer la navigation souhaitée.

## Usage

```html
<PixNavigation @variant="orga" @navigationAriaLabel="navigation principale">
<:brand>
<!-- Affichage du block indentité -->
<a href="/">
<img src="/pix-orga.svg" alt="pix orga" />
</a>
</:brand>
<:navElements>
<!-- Affichage du block de navigation -->
<PixNavigationButton
@route="navigation-sidebar-page"
@icon="conversionPath"
>Campagnes</PixNavigationButton>
<PixNavigationButton @href="https://pix.fr" @icon="book">Documentation</PixNavigationButton>
<PixNavigationButton
@href="https://pix.fr"
@title="Pix.fr"
@target="_blank"
@icon="help"
@newWindowLabel="ouvre une nouvelle fenêtre"
>Centre d'aide</PixNavigationButton>
</:navElements>
<:footer>
<!-- Affichage du block indentité -->
<p>
1 000 places disponibles
</p>
<PixNavigationSeparator />
<p>
Martin Dupond
</p>
</:footer>
</PixNavigation>
<PixAppLayout>
<PixNavigation @variant="orga" @navigationAriaLabel="navigation principale">
<:brand>
<!-- Affichage du block indentité -->
<a href="/">
<img src="/pix-orga.svg" alt="pix orga" />
</a>
</:brand>
<:navElements>
<!-- Affichage du block de navigation -->
<PixNavigationButton
@route="navigation-sidebar-page"
@icon="conversionPath"
>Campagnes</PixNavigationButton>
<PixNavigationButton @href="https://pix.fr" @icon="book">Documentation</PixNavigationButton>
<PixNavigationButton
@href="https://pix.fr"
@title="Pix.fr"
@target="_blank"
@icon="help"
@newWindowLabel="ouvre une nouvelle fenêtre"
>Centre d'aide</PixNavigationButton>
</:navElements>
<:footer>
<!-- Affichage du block indentité -->
<p>
1 000 places disponibles
</p>
<PixNavigationSeparator />
<p>
Martin Dupond
</p>
</:footer>
</PixNavigation>
<div>
<!-- Placeholder pour afficher le contenus des routes -->
{{yield}}
</div>
</PixAppLayout>
```

## Arguments
Expand Down
5 changes: 5 additions & 0 deletions app/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@
color:var(--pix-neutral-800);
font-size: .75rem
}

#storybook-root.ember-application:has(.pix-app-layout) {
/* remove padding for the pix-navigation story to mimic in-app behaviour */
padding: 0
}

0 comments on commit 654fcbc

Please sign in to comment.