Skip to content

Commit

Permalink
creating TextArea component
Browse files Browse the repository at this point in the history
  • Loading branch information
brenocastelo committed Dec 13, 2022
1 parent 3975178 commit e16ac52
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/docs/src/stories/TextArea.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Box, Text, TextArea, TextAreaProps } from '@ignite-ui/react';
import { Meta, StoryObj } from '@storybook/react';
import { StoryFnReactReturnType } from '@storybook/react/dist/ts3.9/client/preview/types';

export default {
title: 'Form/Text Area',
component: TextArea,
args: {},
decorators: [
(Story: () => StoryFnReactReturnType) => {
return (
<Box
as="label"
css={{ display: 'flex', flexDirection: 'column', gap: '$2' }}
>
<Text size="sm">Message:</Text>
{Story()}
</Box>
);
},
],
} as Meta<TextAreaProps>;

export const Primary: StoryObj<TextAreaProps> = {};

export const Disabled: StoryObj<TextAreaProps> = {
args: {
disabled: true,
value: '',
placeholder: '',
},
};
32 changes: 32 additions & 0 deletions packages/react/src/components/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ComponentProps } from 'react';
import { styled } from '../styles';

export const TextArea = styled('textarea', {
backgroundColor: '$gray900',
borderRadius: '$sm',
border: '2px solid $gray900',
padding: '$3 $4',
boxSizing: 'border-box',
color: '$white',
fontFamily: '$default',
fontWeight: '$regular',
fontSize: '$sm',
resize: 'vertical',
minHeight: '80',

'&:focus': {
outline: 0,
borderColor: '$ignite300',
},

'&:disabled': {
opacity: 0.5,
cursor: 'not-allowed',
},

'&:placeholder': {
color: '$gray400',
},
});

export interface TextAreaProps extends ComponentProps<typeof TextArea> {}
1 change: 1 addition & 0 deletions packages/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './components/Heading';
export * from './components/Avatar';
export * from './components/Button';
export * from './components/TextInput';
export * from './components/TextArea';

0 comments on commit e16ac52

Please sign in to comment.