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

[TECH] Affiche toutes les icônes dans la story de PixIcon #738

Merged
merged 1 commit into from
Oct 9, 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
6 changes: 4 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '../app/styles/global.css';

const preview = {
parameters: {
layout: 'centered',
Expand Down Expand Up @@ -33,11 +35,11 @@ const preview = {
'Breaking changes',
'Faire une release',
'Architecture',
'Storybook'
'Storybook',
],
],
},
},
}
},
};
export default preview;
4 changes: 2 additions & 2 deletions app/stories/pix-icon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import * as ComponentStories from './pix-icon.stories';

> Permet d'utiliser les icônes disponible du Design System.

<Story of={ComponentStories.icon} height={60} />
<Story of={ComponentStories.allIcons} height={1050} />

## Usage

```html
<PixIcon @name="powerSettings", @plainIcon={{true}} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y a une virgule en trop entre les 2 paramètres

<PixIcon @name="playCircle" @plainIcon="{{true}}" />
```

## Arguments
Expand Down
31 changes: 31 additions & 0 deletions app/stories/pix-icon.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,34 @@ export const icon = (args) => ({
/>`,
context: args,
});

const icons = Object.entries(ICONS).flatMap(([name, icon]) =>
icon.plainIcon
? [
{ iconName: name, variant: false },
{ iconName: name, variant: true },
]
: { iconName: name, variant: false },
);

export const allIcons = (args) => {
return {
template: hbs`<ul class='icon-list'>
{{#each this.icons as |icon|}}
<li class='icon-list__cell'>
<PixIcon
@name={{icon.iconName}}
@plainIcon={{icon.variant}}
@alternativeText={{icon.iconName}}
@ariaHidden={{true}}
/>
<p class='icon-name'>{{icon.iconName}}&nbsp;{{if icon.variant '(plain)'}}</p>
</li>
{{/each}}
</ul>`,
context: args,
};
};

allIcons.bind({});
allIcons.args = { icons };
24 changes: 24 additions & 0 deletions app/styles/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* on utilise un fichier css car on a pas de loader scss */
.icon-list {
display: grid;
grid-template-columns: repeat(9, 1fr);
gap: .4rem;
}

.icon-list__cell {
display: flex;
flex-direction: column;
align-items: center;
height:60px;
padding-bottom: .3rem;
}

.icon-list__cell svg {
width: 2rem;
height: 2rem;
}

.icon-name {
color:var(--pix-neutral-800);
font-size: .75rem
}