-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
495 additions
and
23 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/components/LetterDetailPage/DeleteButton/DeleteButton.stories.tsx
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,27 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { DeleteButton } from './DeleteButton'; | ||
|
||
const meta: Meta<typeof DeleteButton> = { | ||
component: DeleteButton, | ||
title: 'atoms/DeleteButton', | ||
tags: ['autodocs'], | ||
argTypes: { | ||
onClick: { | ||
action: 'clicked', | ||
description: '๋ฒํผ ํด๋ฆญ ์ ํธ์ถ๋๋ ํจ์', | ||
table: { | ||
type: { summary: '() => void' } | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof DeleteButton>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
onClick: () => alert('ํธ์ง๊ฐ ์ญ์ ๋์์ต๋๋ค!') | ||
} | ||
}; |
17 changes: 17 additions & 0 deletions
17
src/components/LetterDetailPage/DeleteButton/DeleteButton.tsx
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,17 @@ | ||
import { RiDeleteBin5Line } from 'react-icons/ri'; | ||
type DeleteButtonProps = { | ||
id: string; | ||
onClick: (id: string) => void; | ||
}; | ||
|
||
export const DeleteButton = ({ id, onClick }: DeleteButtonProps) => { | ||
return ( | ||
<button | ||
onClick={() => onClick(id)} | ||
className="btn-base flex-center gap-1 p-2 " | ||
> | ||
<RiDeleteBin5Line /> | ||
์ญ์ ํ๊ธฐ | ||
</button> | ||
); | ||
}; |
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
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,14 @@ | ||
import { IoCloseOutline } from 'react-icons/io5'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
export const NotificationAppBar = () => { | ||
return ( | ||
<div className="w-full flex items-center justify-between"> | ||
<h1 className="text-[20px] font-semibold text-[#5C5C5C]">์๋ฆผํจ</h1> | ||
|
||
<NavLink to={'/'}> | ||
<IoCloseOutline className="size-[34px] text-[#5C5C5C]" /> | ||
</NavLink> | ||
</div> | ||
); | ||
}; |
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,5 @@ | ||
// src/mocks/browser.ts | ||
import { setupWorker } from 'msw/browser'; | ||
import { handlers } from './handlers'; | ||
|
||
export const worker = setupWorker(...handlers); |
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,90 @@ | ||
import { http, HttpResponse } from 'msw'; | ||
import { UserType } from '@/types/user'; | ||
|
||
type LoginRequestBody = { | ||
email: string; | ||
password: string; | ||
}; | ||
|
||
type LoginResponseBody = { | ||
code: number; | ||
status: string; | ||
message: string; | ||
data: UserType | null; | ||
}; | ||
|
||
export const LoginHandler = [ | ||
http.post<never, LoginRequestBody, LoginResponseBody, '*/auth/signin'>( | ||
'*/auth/signin', | ||
async ({ request }) => { | ||
const { email } = await request.json(); | ||
console.log(email); | ||
// ๋ก๊ทธ์ธ ์ฑ๊ณต | ||
if (email === '[email protected]') { | ||
return HttpResponse.json( | ||
{ | ||
code: 200, | ||
status: 'OK', | ||
message: '๋ก๊ทธ์ธ ์ฑ๊ณต', | ||
data: { | ||
email: email, | ||
nickname: 'ํ ์คํธ์ ์ ', | ||
profileImageUrl: 'sample.jpg' | ||
} | ||
}, | ||
{ | ||
status: 200, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Set-Cookie': | ||
'accessToken=test-token123; Path=/; HttpOnly' | ||
} | ||
} | ||
); | ||
} | ||
|
||
// ์กด์ฌํ์ง ์๋ ์ ์ | ||
if (email === '[email protected]') { | ||
return HttpResponse.json( | ||
{ | ||
code: 400, | ||
status: 'USER_NOT_FOUND', | ||
message: '์กด์ฌํ์ง ์๋ ์ ์ ', | ||
data: null | ||
}, | ||
{ | ||
status: 400 | ||
} | ||
); | ||
} | ||
|
||
// ์ค๋ฅ | ||
if (email === '[email protected]') { | ||
return HttpResponse.json( | ||
{ | ||
code: 500, | ||
status: 'INTERNER_SERVER_ERROR', | ||
message: '๋ก๊ทธ์ธ ์คํจ', | ||
data: null | ||
}, | ||
{ | ||
status: 500 | ||
} | ||
); | ||
} | ||
|
||
// ๊ธฐ๋ณธ ์๋ฌ | ||
return HttpResponse.json( | ||
{ | ||
code: 400, | ||
status: 'BAD_REQUEST', | ||
message: '์๋ชป๋ ์์ฒญ์ ๋๋ค', | ||
data: null | ||
}, | ||
{ | ||
status: 400 | ||
} | ||
); | ||
} | ||
) | ||
]; |
Oops, something went wrong.