Skip to content

Commit

Permalink
Add Textarea component (#1522)
Browse files Browse the repository at this point in the history
robines authored Oct 9, 2024
1 parent 69fa949 commit dace444
Showing 4 changed files with 47 additions and 0 deletions.
33 changes: 33 additions & 0 deletions frontend/src/Components/Textarea/Textarea.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import 'src/constants';

@import 'src/mixins';

.textarea {
@include rounded-lighter;
padding: 0.75rem 1rem;
border: 1px solid $grey-35;
margin-top: 0.5em; // Make sure this is the same for all inputs that should be used together
outline: none;
font-weight: initial;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
width: 100%;
resize: vertical;
min-height: 2.75rem;

&:focus {
border-color: $grey-3;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
outline: 1px solid rgba(0, 0, 0, 0.1);
}
&.error {
border: 1px solid $red;
}

@include theme-dark {
border-color: $grey-0;
&:focus {
border-color: $grey-1;
outline: 1px solid rgba(255, 255, 255, 0.6);
}
}
}
12 changes: 12 additions & 0 deletions frontend/src/Components/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import classNames from 'classnames';
import React from 'react';
import styles from './Textarea.module.scss';

export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}

const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(({ className, ...props }, ref) => {
return <textarea className={classNames(styles.textarea, className)} ref={ref} {...props} />;
});
Textarea.displayName = 'Textarea';

export { Textarea };
1 change: 1 addition & 0 deletions frontend/src/Components/Textarea/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { type TextareaProps, Textarea } from './Textarea';
1 change: 1 addition & 0 deletions frontend/src/Components/index.ts
Original file line number Diff line number Diff line change
@@ -77,6 +77,7 @@ export { Logo } from './Logo';
export { TabBar } from './TabBar';
export { TabView } from './TabView';
export { Text } from './Text';
export { type TextareaProps, Textarea } from './Textarea';
export { Table } from './Table';
export { OccupiedFormModal } from './OccupiedForm';
export { OccupiedForm } from './OccupiedForm';

0 comments on commit dace444

Please sign in to comment.