-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/f-lab-edu/eungeori into โฆ
โฆfeat/calender
- Loading branch information
Showing
51 changed files
with
3,862 additions
and
1,948 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { inputStyle } from "@/app/components/common/input.css"; | ||
import { pink80 } from "@/app/styles/colors.css"; | ||
import { caption, regular } from "@/app/styles/font.css"; | ||
import { paddingSprinkles } from "@/app/styles/padding.css"; | ||
import { HTMLInputTypeAttribute } from "react"; | ||
import { UseFormRegister } from "react-hook-form"; | ||
|
||
type InputUiProps = { | ||
text: string; | ||
type?: HTMLInputTypeAttribute; | ||
maxLegnth: number; | ||
register: ReturnType<UseFormRegister<any>>; | ||
errorMessage: string | undefined; | ||
}; | ||
|
||
const FormInputUI = ({ text, type, maxLegnth, register, errorMessage }: InputUiProps) => { | ||
return ( | ||
<div> | ||
<p className={`${caption} ${regular} ${paddingSprinkles({ paddingBottom: "s4" })}`}> | ||
{text} | ||
<span className={`${pink80}`}>*</span> | ||
</p> | ||
<input placeholder={text} className={inputStyle} {...register} maxLength={maxLegnth} type={type} /> | ||
|
||
<p className={`${paddingSprinkles({ paddingTop: "s4" })} ${caption} ${pink80}`}>{errorMessage}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FormInputUI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useLogin } from "./useLogin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import Button from "@/app/components/common/Button"; | ||
import { flexSprinklesFc } from "@/app/components/common/utils/flex"; | ||
import { colors } from "@/app/styles/colors.css"; | ||
import { signupSchema } from "@/app/types/signupSchema"; | ||
import { zodResolver } from "@hookform/resolvers/zod"; | ||
import { useForm } from "react-hook-form"; | ||
import { z } from "zod"; | ||
import { useSignup } from "../hook"; | ||
import FormInputUI from "../../common/inputUI"; | ||
|
||
const SignupForm = () => { | ||
const { | ||
register, | ||
handleSubmit, | ||
formState: { errors, isValid }, | ||
} = useForm<z.infer<typeof signupSchema>>({ | ||
resolver: zodResolver(signupSchema), | ||
mode: "onChange", | ||
defaultValues: { | ||
id: "", | ||
password: "", | ||
confirmPassword: "", | ||
nickname: "", | ||
}, | ||
}); | ||
|
||
const { onSignupSubmit } = useSignup(); | ||
|
||
return ( | ||
<form | ||
onSubmit={handleSubmit(onSignupSubmit)} | ||
className={flexSprinklesFc({ flexDirection: "column", gap: "32px" })} | ||
> | ||
<div className={flexSprinklesFc({ flexDirection: "column", gap: "8px" })}> | ||
<FormInputUI | ||
text="์์ด๋" | ||
maxLegnth={10} | ||
register={register("id")} | ||
errorMessage={errors.id?.message} | ||
/> | ||
|
||
<FormInputUI | ||
text="๋น๋ฐ๋ฒํธ" | ||
type="password" | ||
maxLegnth={12} | ||
register={register("password")} | ||
errorMessage={errors.password?.message} | ||
/> | ||
|
||
<FormInputUI | ||
text="๋น๋ฐ๋ฒํธ ํ์ธ" | ||
type="password" | ||
maxLegnth={12} | ||
register={register("confirmPassword")} | ||
errorMessage={errors.confirmPassword?.message} | ||
/> | ||
|
||
<FormInputUI | ||
text="๋๋ค์" | ||
maxLegnth={12} | ||
register={register("nickname")} | ||
errorMessage={errors.nickname?.message} | ||
/> | ||
</div> | ||
|
||
<div> | ||
<Button | ||
text="๊ฐ์ ํ๊ธฐ" | ||
width="100%" | ||
background={isValid ? colors.point : colors.gray200} | ||
color={colors.white} | ||
fontSize="12px" | ||
disabled={!isValid} | ||
/> | ||
</div> | ||
</form> | ||
); | ||
}; | ||
|
||
export default SignupForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Button from "@/app/components/common/Button"; | ||
import Popup from "@/app/components/common/Popup"; | ||
import { usePopupStore } from "@/app/store/popup/PopupStore"; | ||
import { colors } from "@/app/styles/colors.css"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
const messageRoute: Record<string, string | null> = { | ||
"์ด๋ฏธ ์กด์ฌํ๋ ํ์์ ๋๋ค.": null, | ||
"์ด๋ฏธ ์กด์ฌํ๋ ๋๋ค์์ ๋๋ค.": null, | ||
"ํ์๊ฐ์ ์ด ์๋ฃ๋์ต๋๋ค.": "/", | ||
}; | ||
|
||
const SignupPopup = () => { | ||
const router = useRouter(); | ||
const signupMessageState = usePopupStore((state) => state.message); | ||
const signupPopupState = usePopupStore((state) => state.isPopup); | ||
const setSignupPopupState = usePopupStore((state) => state.setIsPopup); | ||
|
||
const onClick = () => { | ||
const route = signupMessageState ? messageRoute[signupMessageState] : null; | ||
|
||
if (route) { | ||
setSignupPopupState(false); | ||
router.push(route); | ||
} else { | ||
setSignupPopupState(false); | ||
} | ||
}; | ||
return ( | ||
<div> | ||
{signupPopupState && ( | ||
<Popup text={signupMessageState}> | ||
<Button | ||
width="115px" | ||
text="ํ์ธ" | ||
onClick={onClick} | ||
color={colors.white} | ||
background={colors.primary} | ||
/> | ||
</Popup> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default SignupPopup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useSignup } from "./useSignup"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { usePopupStore } from "@/app/store/popup/PopupStore"; | ||
import { LocalStorage } from "@/app/types/localStorageSchema"; | ||
import { signupSchema } from "@/app/types/signupSchema"; | ||
import { z } from "zod"; | ||
|
||
export const useSignup = () => { | ||
const setIsPopupState = usePopupStore((state) => state.setIsPopup); | ||
const setMessageState = usePopupStore((state) => state.setMessage); | ||
|
||
const onSignupSubmit = (data: z.infer<typeof signupSchema>) => { | ||
const signupStorage = new LocalStorage("signup"); | ||
|
||
if (data.id === signupStorage.get()?.id) { | ||
setIsPopupState(true); | ||
setMessageState("์ด๋ฏธ ์กด์ฌํ๋ ํ์์ ๋๋ค."); | ||
return; | ||
} | ||
|
||
if (data.nickname === signupStorage.get()?.nickname) { | ||
setIsPopupState(true); | ||
setMessageState("์ด๋ฏธ ์กด์ฌํ๋ ๋๋ค์์ ๋๋ค."); | ||
return; | ||
} | ||
|
||
if (data) { | ||
setIsPopupState(true); | ||
setMessageState("ํ์๊ฐ์ ์ด ์๋ฃ๋์ต๋๋ค."); | ||
signupStorage.set(data); | ||
} | ||
}; | ||
|
||
return { onSignupSubmit }; | ||
}; |
Oops, something went wrong.