diff --git a/src/Register/components/NicknameInput/NicknameInput.style.ts b/src/Register/components/NicknameInput/NicknameInput.style.ts new file mode 100644 index 00000000..1acceffc --- /dev/null +++ b/src/Register/components/NicknameInput/NicknameInput.style.ts @@ -0,0 +1,47 @@ +import styled from '@emotion/styled'; + +export const NicknameWrapper = styled.section` + display: flex; + align-items: center; + flex-direction: column; + + width: 100%; + gap: 1.7rem; +`; + +export const Question = styled.p` + width: 100%; + + color: ${({ theme }) => theme.colors.BG}; + + ${({ theme }) => theme.fonts.Head2_SB_18}; +`; + +export const InputContainer = styled.div<{ isEmpty: boolean }>` + display: flex; + justify-content: space-between; + align-items: center; + + width: 100%; + padding: 1.9rem 2rem; + gap: 1.6rem; + + ${({ theme }) => theme.fonts.Body3_R_14}; + + border: 0.1rem solid + ${({ theme, isEmpty }) => (isEmpty ? theme.colors.LG : theme.colors.BG)}; + border-radius: 0.8rem; + background-color: ${({ theme }) => theme.colors.white}; +`; + +export const Input = styled.input` + width: 100%; + + color: ${({ theme }) => theme.colors.BG}; + ${({ theme }) => theme.fonts.Body2_M_14}; +`; + +export const WordCount = styled.p` + color: ${({ theme }) => theme.colors.WG}; + ${({ theme }) => theme.fonts.E_Body2_R_14}; +`; diff --git a/src/Register/components/NicknameInput/index.tsx b/src/Register/components/NicknameInput/index.tsx new file mode 100644 index 00000000..d524dc1b --- /dev/null +++ b/src/Register/components/NicknameInput/index.tsx @@ -0,0 +1,57 @@ +import React, { useEffect, useState } from 'react'; + +import * as S from './NicknameInput.style'; + +type setIsActiveProps = { + setIsActive: React.Dispatch>; +}; + +function NicknameInput({ setIsActive }: setIsActiveProps) { + const [wordCnt, setWordCnt] = useState(0); + const [nickname, setNickname] = useState(''); + + /** 영어, 숫자, 문자, 공백인지 체크하는 정규식 함수 */ + const checkInputRange = (str: string) => { + const regExp = /[ㄱ-ㅎㅏ-ㅣ가-힣0-9a-zA-Z\s]/g; + return regExp.test(str) || str.length === 0; + }; + + /** 8자 이하 & 한글, 영어, 숫자만 입력 가능하도록 & 첫번째 글자는 공백 불가능 체크 함수*/ + const handleChangeInput = (e: React.ChangeEvent) => { + const input = e.target.value; + + if ( + e.target.value.length <= 8 && + checkInputRange(input[input.length - 1]) + ) { + if (e.target.value === ' ') { + setNickname(''); + setWordCnt(0); + } else { + setNickname(e.target.value); + setWordCnt(e.target.value.length); + } + } + }; + + useEffect(() => { + wordCnt >= 2 ? setIsActive(true) : setIsActive(false); + }, [wordCnt]); + + return ( + + 레큐에서 사용할 닉네임 + + + ({wordCnt}/8) + + + ); +} + +export default NicknameInput; diff --git a/src/Register/components/RegisterLogo/RegisterLogo.style.ts b/src/Register/components/RegisterLogo/RegisterLogo.style.ts new file mode 100644 index 00000000..ca6b51e9 --- /dev/null +++ b/src/Register/components/RegisterLogo/RegisterLogo.style.ts @@ -0,0 +1,6 @@ +import styled from '@emotion/styled'; + +export const LogoWrapper = styled.section` + width: 100%; + padding: 6rem 17rem 6rem 0; +`; diff --git a/src/Register/components/RegisterLogo/index.tsx b/src/Register/components/RegisterLogo/index.tsx new file mode 100644 index 00000000..7c0d2444 --- /dev/null +++ b/src/Register/components/RegisterLogo/index.tsx @@ -0,0 +1,12 @@ +import { ImgLogoLecue } from '../../../assets'; +import * as S from './RegisterLogo.style'; + +function RegisterLogo() { + return ( + + + + ); +} + +export default RegisterLogo; diff --git a/src/Register/components/SubmitButton/SubmitButton.style.ts b/src/Register/components/SubmitButton/SubmitButton.style.ts new file mode 100644 index 00000000..0690699d --- /dev/null +++ b/src/Register/components/SubmitButton/SubmitButton.style.ts @@ -0,0 +1,11 @@ +import styled from '@emotion/styled'; + +export const ButtonWrapper = styled.section` + display: flex; + justify-content: center; + align-items: end; + + width: 100%; + height: calc(100dvh - 26.7rem); + margin-bottom: 2rem; +`; diff --git a/src/Register/components/SubmitButton/index.tsx b/src/Register/components/SubmitButton/index.tsx new file mode 100644 index 00000000..92b3c112 --- /dev/null +++ b/src/Register/components/SubmitButton/index.tsx @@ -0,0 +1,18 @@ +import Button from '../../../components/common/Button'; +import * as S from './SubmitButton.style'; + +type SubmitButtonProps = { + isActive: boolean; +}; + +function SubmitButton({ isActive }: SubmitButtonProps) { + return ( + + + + ); +} + +export default SubmitButton; diff --git a/src/Register/constants/.gitkeep b/src/Register/constants/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/Register/hooks/.gitkeep b/src/Register/hooks/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/Register/page/Register.style.ts b/src/Register/page/Register.style.ts new file mode 100644 index 00000000..a7fdcd64 --- /dev/null +++ b/src/Register/page/Register.style.ts @@ -0,0 +1,13 @@ +import styled from '@emotion/styled'; + +export const Wrapper = styled.article` + display: flex; + align-items: center; + flex-direction: column; + + width: 100vw; + height: 100dvh; + padding: 0 1.6rem; + + background-color: ${({ theme }) => theme.colors.background}; +`; diff --git a/src/Register/page/index.tsx b/src/Register/page/index.tsx new file mode 100644 index 00000000..a12ec37e --- /dev/null +++ b/src/Register/page/index.tsx @@ -0,0 +1,20 @@ +import { useState } from 'react'; + +import NicknameInput from '../components/NicknameInput'; +import RegisterLogo from '../components/RegisterLogo'; +import SubmitButton from '../components/SubmitButton'; +import * as S from './Register.style'; + +function Register() { + const [isActive, setIsActive] = useState(false); + + return ( + + + + + + ); +} + +export default Register; diff --git a/src/Router.tsx b/src/Router.tsx index e2d82980..fcf6ded4 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -1,5 +1,7 @@ import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import HomePage from './Home/page/HomePage'; +import Register from './Register/page'; import DetailPage from './Detail/page/DetailPage'; import HealthTest from './HealthTest'; import LecueNotePage from './LecueNote/page/LeceuNotePage'; @@ -11,6 +13,8 @@ function Router() { return ( + } /> + } /> } /> } /> } />