diff --git a/.eslintrc.json b/.eslintrc.json index 82d37c6..873d97a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,7 +7,6 @@ "plugins": ["prettier"], "rules": { "prettier/prettier": ["error"], - "no-unused-vars": "warn", "@typescript-eslint/no-unused-vars": "warn" } } diff --git a/src/app/mypage/components/Button.module.css b/src/app/mypage/components/Button.module.css deleted file mode 100644 index 98e57e4..0000000 --- a/src/app/mypage/components/Button.module.css +++ /dev/null @@ -1,14 +0,0 @@ -.button { - width: 100%; - background-color: var(--violet); - border-radius: 8px; - font-size: 14px; - font-weight: 600; - line-height: 24px; - color: var(--white); -} - -.button:disabled { - background-color: var(--gray-400); - cursor: auto; -} diff --git a/src/app/mypage/components/Button.tsx b/src/app/mypage/components/Button.tsx deleted file mode 100644 index cf832c9..0000000 --- a/src/app/mypage/components/Button.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { ButtonHTMLAttributes, PropsWithChildren } from 'react'; -import styles from './Button.module.css'; - -interface ButtonProps extends ButtonHTMLAttributes { - className?: string; -} - -export default function Button({ - className = '', - children, - ...props -}: PropsWithChildren) { - return ( - - ); -} diff --git a/src/app/mypage/components/FileInput.tsx b/src/app/mypage/components/FileInput.tsx index 2872e21..11f1b56 100644 --- a/src/app/mypage/components/FileInput.tsx +++ b/src/app/mypage/components/FileInput.tsx @@ -1,28 +1,35 @@ +import { useEffect } from 'react'; import { ChangeEvent, useState } from 'react'; import Image from 'next/image'; -import { UseFormSetValue } from 'react-hook-form'; -import { FormValues } from './ProfileForm'; import styles from './FileInput.module.css'; interface FileInputProps { - name: 'imgFile'; - setValue: UseFormSetValue; + id: string; + name: 'image'; + setValue: (name: 'image', value: File | null) => void; + url?: string | null; } -export default function FileInput({ name, setValue }: FileInputProps) { - const [preview, setPreview] = useState(''); +export default function FileInput({ name, setValue, url, id }: FileInputProps) { + const [preview, setPreview] = useState(null); const handleChange = (event: ChangeEvent) => { const file = event.target.files?.[0]; if (file) { setPreview(URL.createObjectURL(file)); - setValue('image', file); + setValue(name, file); } }; + useEffect(() => { + if (url) { + setPreview(url); + } + }, [url]); + return ( <> -