import React, { useState } from 'react'; import { StoryFn, Meta } from '@storybook/react'; import { AlignItems, Display, IconColor, FlexDirection, JustifyContent, TextVariant, FlexWrap, TextAlign, BackgroundColor, BorderColor, Color, BorderRadius, } from '../../../helpers/constants/design-system'; import Box from '../../ui/box/box'; import { ButtonIcon, ButtonLink, Label, Text, TextField, TextFieldSearch, TEXT_FIELD_SIZES, ButtonIconSize, BUTTON_LINK_SIZES, } 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
);