summaryrefslogtreecommitdiffstats
path: root/src/components/Form/Select/Select.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-02-25 19:17:09 +0100
committerArmand Philippot <git@armandphilippot.com>2022-02-25 19:17:09 +0100
commite26d821f738525477472e631d170d9ed218c1603 (patch)
tree70ec0c29d003d462de6926f1faa09354e3ff6d90 /src/components/Form/Select/Select.tsx
parentcb4764f8670f67627c407591c89b8d3637c190a7 (diff)
chore: combine input/textarea/select in a single component
Diffstat (limited to 'src/components/Form/Select/Select.tsx')
-rw-r--r--src/components/Form/Select/Select.tsx56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/components/Form/Select/Select.tsx b/src/components/Form/Select/Select.tsx
deleted file mode 100644
index feab991..0000000
--- a/src/components/Form/Select/Select.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { ChangeEvent, ReactElement, SetStateAction } from 'react';
-import styles from './Select.module.scss';
-
-type SelectOptions = {
- id: string;
- name: string;
- value: string;
-};
-
-const Select = ({
- options,
- id,
- name,
- value,
- setValue,
- required = false,
- label,
-}: {
- options: SelectOptions[];
- id: string;
- name: string;
- value: string;
- setValue: (value: SetStateAction<string>) => void;
- required?: boolean;
- label?: ReactElement;
-}) => {
- const getOptions = () => {
- return options.map((option) => (
- <option key={option.id} value={option.value}>
- {option.name}
- </option>
- ));
- };
-
- const handleChange = (event: ChangeEvent<HTMLSelectElement>) => {
- setValue(event.target.value);
- };
-
- return (
- <>
- {label}
- <select
- name={name}
- id={id}
- value={value}
- onChange={handleChange}
- required={required}
- className={styles.wrapper}
- >
- {getOptions()}
- </select>
- </>
- );
-};
-
-export default Select;