1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
George Marshall 8064ec34a1
Dark mode: colors obj UI, GREY, WHITE (#14118)
* Removing all COLORS.UI 1,2,3,4 from codebase

* Removing all unused versions of COLORS.GREY, COLORS.WHITE and some left over UI1,UI2,UI3,UI4 in docs
2022-03-22 12:44:01 -07:00

120 lines
2.8 KiB
JavaScript

import React from 'react';
import { useArgs } from '@storybook/client-api';
import {
COLORS,
RESIZE,
SIZES,
BORDER_STYLE,
BLOCK_SIZES,
} from '../../../helpers/constants/design-system';
import README from './README.mdx';
import Textarea from '.';
export default {
title: 'Components/UI/Textarea',
id: __filename,
component: Textarea,
parameters: {
docs: {
page: README,
},
},
argTypes: {
className: {
control: 'text',
},
value: {
control: 'text',
},
onChange: {
action: 'onChange',
},
resize: {
control: 'select',
options: Object.values(RESIZE),
},
scrollable: {
control: 'boolean',
},
height: {
control: 'number',
},
boxProps: {
control: 'object',
},
},
};
export const DefaultStory = (args) => {
const [{ value }, updateArgs] = useArgs();
const handleOnChange = (e) => {
updateArgs({
value: e.target.value,
});
};
return (
<>
<label htmlFor="textarea">Label</label>
<Textarea {...args} value={value} onChange={handleOnChange} id="textarea">
{args.children}
</Textarea>
</>
);
};
DefaultStory.storyName = 'Default';
DefaultStory.args = {
value:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld',
resize: RESIZE.BOTH,
scrollable: false,
boxProps: {
borderColor: COLORS.BORDER_MUTED,
borderRadius: SIZES.SM,
borderStyle: BORDER_STYLE.SOLID,
padding: [2, 4],
},
height: 'auto',
};
export const Scrollable = (args) => {
const [{ value }, updateArgs] = useArgs();
const handleOnChange = (e) => {
updateArgs({
value: e.target.value,
});
};
return (
<div style={{ width: 280 }}>
<Textarea
{...args}
value={value}
onChange={handleOnChange}
aria-label="textarea"
>
{args.children}
</Textarea>
</div>
);
};
Scrollable.args = {
value:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld, Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporld',
resize: RESIZE.NONE,
scrollable: true,
height: 170,
boxProps: {
borderColor: COLORS.TRANSPARENT,
borderRadius: SIZES.NONE,
borderStyle: BORDER_STYLE.NONE,
padding: [2, 4],
width: BLOCK_SIZES.FULL,
},
};