File tree Expand file tree Collapse file tree 8 files changed +119
-17
lines changed Expand file tree Collapse file tree 8 files changed +119
-17
lines changed Original file line number Diff line number Diff line change
1
+ import { useEditPwState } from '../../stores/editPwStore.ts' ;
2
+
3
+ const EditPwButton = ( ) => {
4
+ const { email, name } = useEditPwState ( ) ;
5
+
6
+ const onClick = ( ) => {
7
+ console . log ( 'email: ' , email ) ;
8
+ console . log ( 'name: ' , name ) ;
9
+ } ;
10
+
11
+ return (
12
+ < button type = { 'submit' } onClick = { onClick } className = "btn btn-outline btn-primary w-full" >
13
+ 비밀번호 변경
14
+ </ button >
15
+ ) ;
16
+ } ;
17
+
18
+ export default EditPwButton ;
Original file line number Diff line number Diff line change
1
+ import InputForm from '../common/InputForm.tsx' ;
2
+ import { useEditPwState } from '../../stores/editPwStore.ts' ;
3
+
4
+ const EmailInput = ( ) => {
5
+ const { email, emailHandler } = useEditPwState ( ) ;
6
+
7
+ return (
8
+ < InputForm
9
+ defaultValue = { email }
10
+ title = { '이메일' }
11
+ placeholder = { '이메일을 입력하세요' }
12
+ hint = { 'Hint Text' }
13
+ onChange = { ( e ) => emailHandler ( e . target . value ) }
14
+ type = { 'email' }
15
+ name = { 'email' }
16
+ />
17
+ ) ;
18
+ } ;
19
+
20
+ export default EmailInput ;
Original file line number Diff line number Diff line change
1
+ import InputForm from '../common/InputForm.tsx' ;
2
+ import { useEditPwState } from '../../stores/editPwStore.ts' ;
3
+
4
+ const NameInput = ( ) => {
5
+ const { name, nameHandler } = useEditPwState ( ) ;
6
+
7
+ return (
8
+ < InputForm
9
+ defaultValue = { name }
10
+ title = { '이름' }
11
+ placeholder = { '이름을 입력하세요' }
12
+ hint = { 'Hint Text' }
13
+ onChange = { ( e ) => nameHandler ( e . target . value ) }
14
+ type = { 'name' }
15
+ name = { 'name' }
16
+ />
17
+ ) ;
18
+ } ;
19
+
20
+ export default NameInput ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ interface Props {
4
4
children : ReactNode ;
5
5
}
6
6
7
- const LoginPageLayout : FC < Props > = ( { children } ) => {
7
+ const CenterPageLayout : FC < Props > = ( { children } ) => {
8
8
return (
9
9
< main className = { 'flex h-screen w-screen items-center justify-center' } >
10
10
< div className = { 'flex h-full w-full max-w-md flex-col items-center justify-around overflow-hidden px-8 py-8' } >
@@ -14,4 +14,4 @@ const LoginPageLayout: FC<Props> = ({ children }) => {
14
14
) ;
15
15
} ;
16
16
17
- export default LoginPageLayout ;
17
+ export default CenterPageLayout ;
Original file line number Diff line number Diff line change @@ -9,12 +9,25 @@ import { NotFound } from './pages/Notfound.tsx';
9
9
import { createBrowserRouter , RouterProvider } from 'react-router-dom' ;
10
10
import JoinPage from './pages/JoinPage.tsx' ;
11
11
import LoginPage from './pages/LoginPage.tsx' ;
12
+ import EditPwPage from './pages/EditPwPage.tsx' ;
12
13
13
14
const router = createBrowserRouter ( [
14
15
{
15
16
path : '/' ,
16
17
element : < App /> ,
17
18
} ,
19
+ {
20
+ path : '/login' ,
21
+ element : < LoginPage /> ,
22
+ } ,
23
+ {
24
+ path : '/join' ,
25
+ element : < JoinPage /> ,
26
+ } ,
27
+ {
28
+ path : '/editPw' ,
29
+ element : < EditPwPage /> ,
30
+ } ,
18
31
{
19
32
path : '*' ,
20
33
element : < NotFound /> ,
@@ -28,14 +41,6 @@ const router = createBrowserRouter([
28
41
} ,
29
42
] ,
30
43
} ,
31
- {
32
- path : 'login' ,
33
- element : < LoginPage /> ,
34
- } ,
35
- {
36
- path : 'join' ,
37
- element : < JoinPage /> ,
38
- } ,
39
44
] ) ;
40
45
const queryClient = new QueryClient ( ) ;
41
46
Original file line number Diff line number Diff line change
1
+ import CenterPageLayout from '../layouts/CenterPageLayout.tsx' ;
2
+ import LoginForm from '../components/login/LoginForm.tsx' ;
3
+ import EmailInput from '../components/EditPw/EmailInput.tsx' ;
4
+ import NameInput from '../components/EditPw/NameInput.tsx' ;
5
+ import LoginFormActions from '../components/login/LoginFormActions.tsx' ;
6
+ import EditPwButton from '../components/EditPw/EditPwButton.tsx' ;
7
+
8
+ const EditPwPage = ( ) => {
9
+ return (
10
+ < CenterPageLayout >
11
+ < LoginForm >
12
+ < NameInput />
13
+ < EmailInput />
14
+ </ LoginForm >
15
+ < LoginFormActions >
16
+ < EditPwButton />
17
+ </ LoginFormActions >
18
+ </ CenterPageLayout >
19
+ ) ;
20
+ } ;
21
+
22
+ export default EditPwPage ;
Original file line number Diff line number Diff line change 1
- import LoginPageLayout from '../layouts/CenterPageLayout.tsx' ;
1
+ import CenterPageLayout from '../layouts/CenterPageLayout.tsx' ;
2
2
import VerticalLogo from '../components/common/VerticalLogo.tsx' ;
3
3
import LoginForm from '../components/login/LoginForm.tsx' ;
4
4
import EmailInput from '../components/login/EmailInput.tsx' ;
5
- import PasswordInput from '../components/login/PasswordInput.tsx' ;
6
5
import LoginFormActions from '../components/login/LoginFormActions.tsx' ;
7
6
import LoginButton from '../components/login/LoginButton.tsx' ;
8
7
import LoginNavigation from '../components/login/LoginNavigation.tsx' ;
9
8
import LoginNavigationLink from '../components/login/LoginNavigationLink.tsx' ;
9
+ import NameInput from '../components/Join/NameInput.tsx' ;
10
10
11
11
const LoginPage = ( ) => {
12
12
return (
13
- < LoginPageLayout >
13
+ < CenterPageLayout >
14
14
< VerticalLogo />
15
15
< LoginForm >
16
+ < NameInput />
16
17
< EmailInput />
17
- < PasswordInput />
18
18
</ LoginForm >
19
19
< LoginFormActions >
20
20
< LoginButton />
21
21
< LoginNavigation >
22
- < LoginNavigationLink text = { '비밀번호 찾기' } to = { '/' } />
23
- < LoginNavigationLink text = { '회원가입' } to = { '/' } />
22
+ < LoginNavigationLink text = { '비밀번호 찾기' } to = { '/editPw ' } />
23
+ < LoginNavigationLink text = { '회원가입' } to = { '/join ' } />
24
24
</ LoginNavigation >
25
25
</ LoginFormActions >
26
- </ LoginPageLayout >
26
+ </ CenterPageLayout >
27
27
) ;
28
28
} ;
29
29
Original file line number Diff line number Diff line change
1
+ import { create } from 'zustand' ;
2
+
3
+ interface EditPwState {
4
+ email : string ;
5
+ name : string ;
6
+
7
+ emailHandler : ( email : string ) => void ;
8
+ nameHandler : ( name : string ) => void ;
9
+ }
10
+
11
+ export const useEditPwState = create < EditPwState > ( ) ( ( set ) => ( {
12
+ email : '' ,
13
+ name : '' ,
14
+
15
+ emailHandler : ( email : string ) => set ( ( state ) => ( { email, name : state . name } ) ) ,
16
+ nameHandler : ( name : string ) => set ( ( state ) => ( { email : state . email , name } ) ) ,
17
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments