Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
docs: 📝 add iconography storybook story
Browse files Browse the repository at this point in the history
  • Loading branch information
velenyx committed Sep 23, 2023
1 parent bf9e680 commit 9987c83
Show file tree
Hide file tree
Showing 5 changed files with 997 additions and 9 deletions.
5 changes: 3 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
"@storybook/addon-essentials": "7.2.1",
"@storybook/addon-interactions": "7.2.1",
"@storybook/addon-links": "7.2.1",
"@storybook/addon-onboarding": "1.0.8",
"@storybook/blocks": "7.2.1",
"@storybook/addon-mdx-gfm": "^7.4.4",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.4.4",
"@storybook/nextjs": "7.2.1",
"@storybook/react": "7.2.1",
"@storybook/testing-library": "0.2.0",
Expand Down
24 changes: 24 additions & 0 deletions client/src/shared/assets/icons.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.iconItemStyle {
border-radius: 4px;
background: #00000082;
box-shadow: rgba(0, 0, 0, 0.10) 0 1px 3px 0;
border: 1px solid hsla(203, 50%, 30%, 0.15);
overflow: hidden;
height: 40px;
width: 40px;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-flex: none;
-ms-flex: none;
flex: none;
}
18 changes: 18 additions & 0 deletions client/src/shared/assets/icons.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {IconGallery, IconItem, Meta} from '@storybook/blocks';

import {ICON_OPTIONS} from './storybook';
import styles from './icons.module.scss'

<Meta title='global/iconography' />

# Iconography

<IconGallery>
{Object.entries(ICON_OPTIONS).map(([iconName, iconComponent]) => (
<IconItem name={iconName} key={iconName}>
<div className={styles.iconItemStyle}>
{iconComponent}
</div>
</IconItem>
))}
</IconGallery>
10 changes: 10 additions & 0 deletions client/src/shared/assets/storybook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as ICONS from './index';

type IconOptions = Record<keyof typeof ICONS, React.ReactNode>;
export const ICON_OPTIONS = Object.entries(ICONS).reduce<IconOptions>(
(acc, [iconName, IconComponent]) => {
acc[iconName.replace(/icon$/i, '') as keyof typeof ICONS] = IconComponent({});
return acc;
},
{} as IconOptions
);
Loading

0 comments on commit 9987c83

Please sign in to comment.