import React, { useState } from 'react';
import {
Size,
AlignItems,
DISPLAY,
IconColor,
FLEX_DIRECTION,
JustifyContent,
TextVariant,
FLEX_WRAP,
TEXT_ALIGN,
BackgroundColor,
BorderColor,
Color,
BorderRadius,
} from '../../../helpers/constants/design-system';
import Box from '../../ui/box/box';
import {
ButtonIcon,
ButtonLink,
ICON_NAMES,
ICON_SIZES,
Icon,
Label,
Text,
TextField,
TextFieldSearch,
} from '..';
import README from './README.mdx';
const marginSizeControlOptions = [
undefined,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
'auto',
];
export default {
title: 'Components/ComponentLibrary/Icon',
component: Icon,
parameters: {
docs: {
page: README,
},
},
argTypes: {
name: {
control: 'select',
options: Object.values(ICON_NAMES),
},
size: {
control: 'select',
options: Object.values(ICON_SIZES),
},
color: {
control: 'select',
options: Object.values(IconColor),
},
className: {
control: 'text',
},
marginTop: {
options: marginSizeControlOptions,
control: 'select',
table: { category: 'box props' },
},
marginRight: {
options: marginSizeControlOptions,
control: 'select',
table: { category: 'box props' },
},
marginBottom: {
options: marginSizeControlOptions,
control: 'select',
table: { category: 'box props' },
},
marginLeft: {
options: marginSizeControlOptions,
control: 'select',
table: { category: 'box props' },
},
},
args: {
name: ICON_NAMES.ADD_SQUARE,
color: IconColor.inherit,
size: Size.MD,
},
};
export const DefaultStory = (args) => {
const [search, setSearch] = useState('');
const iconList = Object.keys(ICON_NAMES)
.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 = (args) => (
<>
{Object.keys(ICON_NAMES).map((item) => {
return (
);
})}
>
);
export const SizeStory = (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 = (args) => (
);
ColorStory.storyName = 'Color';
export const LayoutAndSpacing = () => (
Always allow you to opt-out via Settings
0x79fAaFe7B6D5DB5D8c63FE88DFF0AF1Fe53358db
Create account
{' '}
Warning
);