Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #98 from Synthetixio/feat/icon-pack
Browse files Browse the repository at this point in the history
feat: Synthetix icon component added
  • Loading branch information
Rickk137 authored Jun 17, 2022
2 parents debcb97 + 96559ac commit ec5c8cb
Show file tree
Hide file tree
Showing 10 changed files with 544 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/components/Icon/Icon.stories.tsx
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'
};
87 changes: 87 additions & 0 deletions src/components/Icon/Icon.tsx
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';
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Dialog, DialogProps } from './Dialog/Dialog';
import { Dropdown, DropdownProps } from './Dropdown/Dropdown';
import { ExternalLink, ExternalLinkProps } from './ExternalLink/ExternalLink';
import { FieldAttributesProps } from './FieldAttributes/FieldAttributes';
import { Icon, IconProps } from './Icon/Icon';
import { IconButton, IconButtonProps } from './IconButton/IconButton';
import { Pagination, PaginationProps } from './Pagination/Pagination';
import { Radio, RadioProps } from './Radio/Radio';
Expand All @@ -37,6 +38,7 @@ export {
Dialog,
Dropdown,
ExternalLink,
Icon,
IconButton,
Pagination,
Radio,
Expand All @@ -61,6 +63,7 @@ export type {
ExternalLinkProps,
FieldAttributesProps,
IconButtonProps,
IconProps,
PaginationProps,
RadioProps,
SelectorProps,
Expand Down
Loading

0 comments on commit ec5c8cb

Please sign in to comment.