Skip to content

Commit 1db8b1d

Browse files
committed
feat: 비밀번호 변경 페이지 디자인 작업
1 parent 894fba9 commit 1db8b1d

File tree

7 files changed

+77
-2
lines changed

7 files changed

+77
-2
lines changed

src/apis/updateUserApi.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import supabase from '@/supabase';
2+
3+
const updateUser = async (password: string) => {
4+
const { data, error } = await supabase.auth.updateUser({ password });
5+
6+
if (error) {
7+
throw error;
8+
}
9+
10+
return data;
11+
};
12+
13+
export default updateUser;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Loading } from '@/pages';
2+
import Dialog from '../Dialog';
3+
import useUpdateUser from '@/react-queries/useUpdateUser';
4+
const ChangePasswordButton = () => {
5+
const { onClick, dialogRef, dialogMessage, isPending } = useUpdateUser();
6+
7+
return (
8+
<>
9+
<button onClick={onClick} className="btn btn-outline text-primary" type="button">
10+
비밀번호 변경하기
11+
</button>
12+
<Dialog ref={dialogRef} desc={dialogMessage}></Dialog>
13+
{isPending && <Loading display="spinner" color="primary" size="lg" />}
14+
</>
15+
);
16+
};
17+
export default ChangePasswordButton;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import ChangePasswordButton from './ChangePasswordButton';
2+
import ChangePasswordInput from './ChangePasswordInput';
3+
4+
const ChangePasswordForm = () => {
5+
return (
6+
<form className="flex flex-1 flex-col justify-between px-8 pb-10">
7+
<ChangePasswordInput />
8+
<ChangePasswordButton />
9+
</form>
10+
);
11+
};
12+
13+
export default ChangePasswordForm;

src/components/Dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const Dialog = forwardRef<DialogElement, Props>((props, ref) => {
3636
{title && <h3 className="text-lg font-bold">{title}</h3>}
3737
<p className={descClassName}>{desc}</p>
3838
{children && <div>{children}</div>}
39-
<form method="dialog" className="modal-action flex justify-center">
39+
<div className="modal-action flex justify-center">
4040
<button type="button" className="btn bg-primary text-base-100" onClick={() => dialogRef.current?.close()}>
4141
닫기
4242
</button>
43-
</form>
43+
</div>
4444
</div>
4545
</dialog>
4646
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { FC, ReactNode } from 'react';
2+
3+
interface Props {
4+
children: ReactNode;
5+
}
6+
7+
const ChangePasswordPageLayout: FC<Props> = ({ children }) => {
8+
return <main className={'flex h-screen w-screen flex-col justify-between pb-8'}>{children}</main>;
9+
};
10+
11+
export default ChangePasswordPageLayout;

src/main.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import App from './App.tsx';
66
import TextInputForm from './pages/InputFormTest.tsx';
77
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
88
import { JoinPage, LoginPage, EditPwPage, NotFound, Policy } from './pages/index.ts';
9+
import ChangePasswordPage from './pages/ChangePasswordPage.tsx';
910

1011
const router = createBrowserRouter([
1112
{
@@ -24,6 +25,10 @@ const router = createBrowserRouter([
2425
path: '/editPw',
2526
element: <EditPwPage />,
2627
},
28+
{
29+
path: '/change-password',
30+
element: <ChangePasswordPage />,
31+
},
2732
{
2833
path: '*',
2934
element: <NotFound />,

src/pages/ChangePasswordPage.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import ChangePasswordForm from '@/components/ChangePassword/ChangePasswordForm';
2+
import HistoryBackButton from '@/components/common/HistoryBackButton';
3+
import ChangePasswordPageLayout from '@/layouts/ChangePasswordPageLayout';
4+
5+
const ChangePasswordPage = () => {
6+
return (
7+
<ChangePasswordPageLayout>
8+
<nav className="px-5 py-2.5">
9+
<HistoryBackButton />
10+
</nav>
11+
<ChangePasswordForm />
12+
</ChangePasswordPageLayout>
13+
);
14+
};
15+
16+
export default ChangePasswordPage;

0 commit comments

Comments
 (0)