import React, { useState } from 'react'; import { StoryFn, Meta } from '@storybook/react'; import { AlignItems, Display, IconColor, FlexDirection, JustifyContent, TextVariant, FlexWrap, TextAlign, BackgroundColor, BorderColor, Color, TextColor, BorderRadius, } from '../../../helpers/constants/design-system'; import { ButtonIcon, ButtonLink, ButtonLinkSize, Label, Text, TextField, TextFieldSearch, TEXT_FIELD_SIZES, ButtonIconSize, Box, } from '..'; import { Icon } from './icon'; import { IconName, IconSize } from './icon.types'; import README from './README.mdx'; export default { title: 'Components/ComponentLibrary/Icon', component: Icon, parameters: { docs: { page: README, }, }, args: { name: IconName.AddSquare, color: IconColor.inherit, size: IconSize.Md, }, } as Meta; export const DefaultStory: StoryFn = (args) => { const [search, setSearch] = useState(''); const iconList = Object.keys(IconName) .filter( (item) => search === '' || item.toLowerCase().includes(search.toLowerCase().replace(' ', '_')), ) .sort(); const handleSearch = (e) => { setSearch(e.target.value); }; const handleOnClear = () => { setSearch(''); }; return ( <> Icon search {/* TODO replace with FormTextField */} {iconList.length > 0 ? ( {iconList.map((item) => { return ( { const tempEl = document.createElement('textarea'); tempEl.value = item; document.body.appendChild(tempEl); tempEl.select(); document.execCommand('copy'); document.body.removeChild(tempEl); }} /> } /> ); })} ) : ( No matches. Please try again or ask in the{' '} #metamask-design-system {' '} channel on slack. )} ); }; DefaultStory.storyName = 'Default'; export const Name: StoryFn = (args) => ( <> {Object.keys(IconName).map((item) => { return ( ); })} ); export const SizeStory: StoryFn = (args) => ( <> inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} inherits the font-size of the parent element.{' '} ); SizeStory.storyName = 'Size'; export const ColorStory: StoryFn = (args) => ( ); ColorStory.storyName = 'Color'; export const LayoutAndSpacing = () => ( Always allow you to opt-out via Settings 0x79fAaFe7B6D5DB5D8c63FE88DFF0AF1Fe53358db Create account
{' '} Warning
);