diff --git a/src/features/setting/Container.tsx b/src/features/setting/Container.tsx index 0a8ccf7..0149d34 100644 --- a/src/features/setting/Container.tsx +++ b/src/features/setting/Container.tsx @@ -12,22 +12,33 @@ const Container = () => { const [, setTitle] = useAtom(titleAtom); const [, setBottomBtn] = useAtom(bottomBtnAtom); - const { handlePreviewClick, handleSubmit, onSubmit, register, control } = - useSetting(); + const { + handlePreviewClick, + handleSubmit, + onSubmit, + register, + control, + formState, + } = useSetting(); useLayoutEffect(() => { setTitle({ title: 'Active', back: true }); - setBottomBtn({ text: 'Save' }); - + setBottomBtn({ + text: 'Save', + disable: !formState.isValid ? true : false, + }); return () => { setTitle({}); setBottomBtn({}); }; - }, []); + }, [formState.isValid]); return (
- + void; + formState: FormState; }; const PreviewSection: FunctionComponent = ({ handlePreviewClick, + formState, }) => { return (
{previewTitleText}
{previewSubText}
-
diff --git a/src/features/setting/components/SubmitForm/DailySticker.tsx b/src/features/setting/components/SubmitForm/DailySticker.tsx index 7c3c5d8..143db1d 100644 --- a/src/features/setting/components/SubmitForm/DailySticker.tsx +++ b/src/features/setting/components/SubmitForm/DailySticker.tsx @@ -3,7 +3,7 @@ import { Controller } from 'react-hook-form'; import { Control } from 'react-hook-form'; import { Inputs } from '../../types'; -import { stickerList, wordStickerText } from '../../constants'; +import { stickerList, stickerText, wordStickerText } from '../../constants'; import moodBad from '/png/mood_BAD.png'; import moodGood from '/png/mood_GOOD.png'; @@ -23,12 +23,19 @@ const DailySticker: FunctionComponent = ({ control }) => { rules={{ required: true }} render={({ field }) => (
- {stickerList.map((sticker) => ( + {stickerList.map((sticker, idx) => (
); diff --git a/src/features/setting/constants.ts b/src/features/setting/constants.ts index f3d7f66..607640f 100644 --- a/src/features/setting/constants.ts +++ b/src/features/setting/constants.ts @@ -1,5 +1,6 @@ export const colorset = ['red', 'yellow', 'green']; -export const stickerList = ['mood_BAD', 'mood_GOOD']; +export const stickerList = ['mood_GOOD', 'mood_BAD']; +export const stickerText = ['GOOD', 'BAD']; export const previewTitleText = 'What is the Active Mood?'; export const previewSubText = diff --git a/src/features/setting/hooks/useSetting.ts b/src/features/setting/hooks/useSetting.ts index ea7a780..5e0af1d 100644 --- a/src/features/setting/hooks/useSetting.ts +++ b/src/features/setting/hooks/useSetting.ts @@ -12,7 +12,7 @@ import badMood from '/png/badge_bad.png'; import { dummyEsl, labelsImagePushPath, token } from '../constants'; const useSetting = () => { - const { register, handleSubmit, control } = useForm({ + const { register, handleSubmit, control, formState } = useForm({ defaultValues: { mood: '', comment: '', @@ -86,6 +86,7 @@ const useSetting = () => { control, onSubmit, handlePreviewClick, + formState, }; }; diff --git a/src/features/setting/style/index.scss b/src/features/setting/style/index.scss index a3cb004..5585d1f 100644 --- a/src/features/setting/style/index.scss +++ b/src/features/setting/style/index.scss @@ -46,11 +46,10 @@ color: #191919; background-color: #ffffff; cursor: pointer; - border-radius: 4px; - } - - &-preview-btn:disabled { - opacity: 0.3; + &:disabled { + opacity: 0.3; + cursor: default; + } } &-word-container { @@ -82,6 +81,7 @@ background: #f7f7f7; padding: 8px 14px; height: 40px; + padding: 0 14px; } &-word-input::placeholder { @@ -124,9 +124,6 @@ appearance: none; -webkit-appearance: none; } - input:checked { - outline: 1px solid #000; - } } &-sticker-width { @@ -134,5 +131,26 @@ img { width: 100%; } + position: relative; + } + + &-sticker-picked { + position: absolute; + width: 100%; + height: 100%; + border: 2px solid #5D8FFF; + background: rgba(93, 143, 255, 0.4); + display: flex; + justify-content: center; + align-items: center; + } + + &-sticker-text { + color: #5D8FFF; + text-align: center; + font-size: 34px; + font-style: normal; + font-weight: 700; + line-height: 100%; /* 34px */ } }