-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create Icon component and organize stories folder * Remove args from story to reduce recursion error * Remove argTypes due to recursion issue * Typesafe icon component color prop and svg fill * Use new Truss font rule generation * Handle rebase * Resolve Fragment issue * Change order of .babel presets to resolve <> issue * Update misc icons in Storybook
- Loading branch information
Showing
18 changed files
with
574 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ dist | |
.vscode/ | ||
.idea/ | ||
.eslintcache | ||
|
||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { Meta } from "@storybook/react"; | ||
import { Css, Icon as IconComponent, IconProps } from "src/"; | ||
|
||
export default { | ||
title: "Components/Icon", | ||
component: IconComponent, | ||
} as Meta<IconProps>; | ||
|
||
export const Icon = () => { | ||
const actionIcons: IconProps["icon"][] = [ | ||
"x", | ||
"loader", | ||
"linkExternal", | ||
"upload", | ||
"download", | ||
"checkboxChecked", | ||
"checkbox", | ||
"check", | ||
"search", | ||
"comment", | ||
"plus", | ||
"pencil", | ||
"cloudUpload", | ||
"toggleOn", | ||
"trash", | ||
]; | ||
const alertIcons: IconProps["icon"][] = ["errorCircle", "checkCircle", "infoCircle", "helpCircle", "error"]; | ||
const arrowIcons: IconProps["icon"][] = [ | ||
"chevronsDown", | ||
"chevronsRight", | ||
"sortUp", | ||
"sortDown", | ||
"chevronDown", | ||
"chevronUp", | ||
"chevronLeft", | ||
"chevronRight", | ||
"arrowBack", | ||
]; | ||
const mediaIcons: IconProps["icon"][] = ["camera", "fileBlank", "folder", "image", "file", "images"]; | ||
const miscIcons: IconProps["icon"][] = ["dollar", "userCircle", "calendar"]; | ||
const navigationIcons: IconProps["icon"][] = ["projects", "tasks", "finances", "templates", "tradePartners"]; | ||
|
||
return ( | ||
<> | ||
<h1 css={Css.xl2Em.$}>Actions</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(5, 1fr)", ...Css.dg.p0.$ }}> | ||
{actionIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
<h1 css={Css.xl2Em.$}>Alerts</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(5, 1fr)", ...Css.dg.p0.$ }}> | ||
{alertIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
<h1 css={Css.xl2Em.$}>Arrows</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(4, 1fr)", ...Css.dg.p0.$ }}> | ||
{arrowIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
<h1 css={Css.xl2Em.$}>Media</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(4, 1fr)", ...Css.dg.p0.$ }}> | ||
{mediaIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
<h1 css={Css.xl2Em.$}>Misc</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(4, 1fr)", ...Css.dg.p0.$ }}> | ||
{miscIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
<h1 css={Css.xl2Em.$}>Navigation</h1> | ||
<ul css={{ gap: 24, listStyle: "none", gridTemplateColumns: "repeat(4, 1fr)", ...Css.dg.p0.$ }}> | ||
{navigationIcons.map((icon, i) => ( | ||
<li css={{ gap: 8, ...Css.xsEm.df.itemsCenter.flexColumn.$ }} key={icon}> | ||
<IconComponent icon={icon} data-testid={icon} id={icon} /> | ||
{icon} | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as ReactDOM from 'react-dom'; | ||
import { Icon } from 'src/'; | ||
|
||
describe('Icon', () => { | ||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<Icon icon="x" />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); | ||
}); |
Oops, something went wrong.