From f6a0a4318c26420f17f7d74115fa5719b3443b8a Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Tue, 8 Oct 2024 16:21:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20common=20select=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Playground.jsx | 88 ++++++++++++++++++++++-- src/components/common/select/QSelect.jsx | 40 +++++++++++ 2 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 src/components/common/select/QSelect.jsx diff --git a/src/components/Playground.jsx b/src/components/Playground.jsx index dbae066f..ad866506 100644 --- a/src/components/Playground.jsx +++ b/src/components/Playground.jsx @@ -11,14 +11,15 @@ import { useMessage } from '@/hooks/useMessage' import { convertDwgToPng } from '@/lib/cadAction' import { cadFileNameState, googleMapFileNameState, useCadFileState, useGoogleMapFileState } from '@/store/canvasAtom' -import QSelect from '@/components/ui/QSelect' import { Button } from '@nextui-org/react' import ColorPicker from './common/color-picker/ColorPicker' import { useSwal } from '@/hooks/useSwal' import styles from './playground.module.css' import Image from 'next/image' + import QInput from './common/input/Qinput' +import QSelect from './common/select/QSelect' export default function Playground() { const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState) @@ -39,6 +40,7 @@ export default function Playground() { const [textInput, setTextInput] = useState('') const [radioInput, setRadioInput] = useState('') const [checkboxInput, setCheckboxInput] = useState([]) + const [selectedValue, setSelectedValue] = useState('') useEffect(() => { console.log('textInput:', textInput) }, [textInput]) @@ -48,6 +50,9 @@ export default function Playground() { useEffect(() => { console.log('checkboxInput:', checkboxInput) }, [checkboxInput]) + useEffect(() => { + console.log('selectedValue:', selectedValue) + }, [selectedValue]) const handleUsers = async () => { // const users = await get('/api/user/find-all') @@ -129,11 +134,28 @@ export default function Playground() { <>
이 영역은 테스트입니다.
-
- - +
+ + + +
+ +
+
- +
+ + + +
{testVar}
diff --git a/src/components/common/select/QSelect.jsx b/src/components/common/select/QSelect.jsx new file mode 100644 index 00000000..fcbbdc2c --- /dev/null +++ b/src/components/common/select/QSelect.jsx @@ -0,0 +1,40 @@ +'use client' + +import { useCallback } from 'react' + +export default function QSelect({ placeholder = '', options, disabled = false, dark = false, value, onChange }) { + // const options = [ + // { id: 's01', value: 'cat', name: '고양이' }, + // { id: 's02', value: 'dog', name: '개' }, + // { id: 's03', value: 'lion', name: '사자' }, + // { id: 's04', value: 'tiger', name: '호랑이' }, + // ] + + const handleChange = useCallback( + (e) => { + onChange(e.target.value) + }, + [onChange], + ) + + return ( +
+
+
+
+ +
+
+
+
+ ) +}