This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from Synthetixio/feat/icon-pack
feat: Synthetix icon component added
- Loading branch information
Showing
10 changed files
with
544 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
import { Icon } from './Icon'; | ||
|
||
export default { | ||
title: 'Icon', | ||
component: Icon, | ||
decorators: [(Story) => <Story />] | ||
} as ComponentMeta<typeof Icon>; | ||
|
||
const Template: ComponentStory<typeof Icon> = (args) => <Icon {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
|
||
Primary.args = { | ||
name: 'Archive', | ||
className: 'ui-text-2xl dark:ui-text-white' | ||
}; |
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,87 @@ | ||
import clsx from 'clsx'; | ||
|
||
export interface IconProps { | ||
name: SynthetixIcon; | ||
className?: string; | ||
cursorPointer?: boolean; | ||
onClick?: () => void; | ||
} | ||
|
||
export const Icon: React.FC<IconProps> = ({ | ||
name, | ||
cursorPointer = false, | ||
className = 'text-lg', | ||
onClick | ||
}) => { | ||
return ( | ||
<i | ||
aria-hidden='true' | ||
className={clsx( | ||
`synthetix-${name}`, | ||
{ | ||
'ui-cursor-pointer': cursorPointer || !!onClick | ||
}, | ||
className | ||
)} | ||
onClick={onClick} | ||
/> | ||
); | ||
}; | ||
|
||
export type SynthetixIcon = | ||
| 'Archive' | ||
| 'Bell' | ||
| 'Bin' | ||
| 'Bottom-2' | ||
| 'Bottom-3' | ||
| 'Bottom' | ||
| 'Burger-indent' | ||
| 'Burger' | ||
| 'Burn' | ||
| 'Caution' | ||
| 'Chart' | ||
| 'Clock' | ||
| 'Collapse' | ||
| 'Comment' | ||
| 'Copy' | ||
| 'Dashboard' | ||
| 'Earn' | ||
| 'Edit' | ||
| 'Exit' | ||
| 'Expand' | ||
| 'Filter' | ||
| 'Governance' | ||
| 'Grid' | ||
| 'Heart' | ||
| 'Horizontal' | ||
| 'Image' | ||
| 'Left-2' | ||
| 'Left-3' | ||
| 'Left-4' | ||
| 'Left' | ||
| 'Link-off' | ||
| 'List' | ||
| 'Megaphone' | ||
| 'Mint' | ||
| 'Minus' | ||
| 'Open-in-new' | ||
| 'Plus' | ||
| 'Right-2' | ||
| 'Right-3' | ||
| 'Right-4' | ||
| 'Right' | ||
| 'rocket' | ||
| 'Search' | ||
| 'Settings' | ||
| 'Small-Cross' | ||
| 'Small-Plus' | ||
| 'Sort' | ||
| 'Stake' | ||
| 'Switch' | ||
| 'Tick' | ||
| 'Top-2' | ||
| 'Top-3' | ||
| 'Top' | ||
| 'Vertical' | ||
| 'Vote' | ||
| 'Wallet'; |
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
Oops, something went wrong.