From 46a2a5c8f558b8685e683a617086593d1778d43c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 30 Jun 2023 22:16:37 -0700 Subject: [PATCH] Removed LabelledInput --- .../common/LabelledInput/index.module.scss | 5 -- components/common/LabelledInput/index.tsx | 68 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 components/common/LabelledInput/index.module.scss delete mode 100644 components/common/LabelledInput/index.tsx diff --git a/components/common/LabelledInput/index.module.scss b/components/common/LabelledInput/index.module.scss deleted file mode 100644 index 1bb2975d..00000000 --- a/components/common/LabelledInput/index.module.scss +++ /dev/null @@ -1,5 +0,0 @@ -.Label { - box-sizing: border-box; - display: grid; - width: 100%; -} diff --git a/components/common/LabelledInput/index.tsx b/components/common/LabelledInput/index.tsx deleted file mode 100644 index 95b201a4..00000000 --- a/components/common/LabelledInput/index.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React, { useEffect, useState } from 'react' -import classNames from 'classnames' - -import styles from './index.module.scss' - -interface Props - extends React.DetailedHTMLProps< - React.InputHTMLAttributes, - HTMLInputElement - > { - visible?: boolean - error?: string - label?: string -} - -const defaultProps = { - visible: true, -} - -const LabelledInput = React.forwardRef(function Input( - props: Props, - forwardedRef -) { - // States - const [inputValue, setInputValue] = useState('') - - // Classes - const classes = classNames({ Input: true }, props.className) - const { defaultValue, visible, ...inputProps } = props - - // Change value when prop updates - useEffect(() => { - if (props.value) setInputValue(`${props.value}`) - }, [props.value]) - - function handleChange(event: React.ChangeEvent) { - setInputValue(event.target.value) - if (props.onChange) props.onChange(event) - } - - return ( - - ) -}) - -LabelledInput.defaultProps = defaultProps - -export default LabelledInput