Skip to content

Commit

Permalink
Merge branch 'main' into develope
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloWook committed Dec 5, 2024
2 parents a54d4d1 + 251765c commit 2036943
Show file tree
Hide file tree
Showing 19 changed files with 495 additions and 23 deletions.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
"react-spring": "^9.7.4",
"react-spring-bottom-sheet": "3.5.0-alpha.0",
"react-textarea-autosize": "^8.5.5",
"react-spring-bottom-sheet": "3.5.0-alpha.0",
"react-textarea-autosize": "^8.5.5",
"sharp": "^0.33.5",
"swiper": "^11.1.15",
"tailwindcss-animated": "^1.1.2",
"tailwindcss-animated": "^1.1.2",
"ts-pattern": "^5.5.0",
"zustand": "^5.0.1"
},
Expand All @@ -54,6 +57,7 @@
"@storybook/test": "8.4.4",
"@types/axios": "^0.14.4",
"@types/canvas-confetti": "^1",
"@types/canvas-confetti": "^1",
"@types/eslint-plugin-jsx-a11y": "^6",
"@types/file-saver": "^2",
"@types/node": "^22.9.1",
Expand Down Expand Up @@ -82,6 +86,7 @@
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"msw": "^2.6.6",
"msw": "^2.6.6",
"postcss": "^8.4.49",
"prettier": "^3.3.3",
"storybook": "8.4.4",
Expand All @@ -98,6 +103,11 @@
"plugin:storybook/recommended"
]
},
"msw": {
"workerDirectory": [
"public"
]
},
"msw": {
"workerDirectory": [
"public"
Expand Down
1 change: 1 addition & 0 deletions src/components/Common/BottleLetter/Label/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { LabelProps } from '@/types/label';
import { LabelProps } from '@/types/label';

export const Label = ({ imgSrc, isActive }: LabelProps) => {
return (
Expand Down
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 src/components/LetterDetailPage/DeleteButton/DeleteButton.tsx
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>
);
};
6 changes: 3 additions & 3 deletions src/components/MapPage/Maplibre/MaplibreWithSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ export const MaplibreWithSearch = ({ onFocus }: MaplibreWithSearchProps) => {

return (
<div className="relative h-[812px] w-full">
<div className="absolute top-2 left-1/2 transform -translate-x-1/2 z-10 bg-white rounded-lg shadow-md p-2 flex items-center space-x-2">
<div className="absolute z-10 flex items-center p-2 space-x-2 transform -translate-x-1/2 bg-white rounded-lg shadow-md top-2 left-1/2">
<input
type="text"
value={searchText}
onChange={(e) => setSearchText(e.target.value)}
placeholder={'์ˆจ๊ธธ ์žฅ์†Œ๋ฅผ ๊ฒ€์ƒ‰ํ•ด๋ณด์„ธ์š”!'}
className="w-72 rounded-md outline-none"
className="rounded-md outline-none w-72"
onFocus={onFocus}
/>
<button className="px-4 py-2">
Expand Down Expand Up @@ -140,7 +140,7 @@ export const MaplibreWithSearch = ({ onFocus }: MaplibreWithSearchProps) => {
latitude={letter.latitude}
>
<div
className="bg-gray-100 p-1 rounded-sm"
className="p-1 bg-gray-100 rounded-sm"
onClick={(e) => {
e.stopPropagation();
toggleSelectedLetter(letter);
Expand Down
6 changes: 3 additions & 3 deletions src/components/MapPage/SearchFullScreen/SearchFullScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SearchFullScreen = ({

return (
<div className="mx-auto min-w-[375px] max-w-[475px]">
<div className="flex items-center pl-3 pr-4 justify-between w-full border-b h-12">
<div className="flex items-center justify-between w-full h-12 pl-3 pr-4 border-b">
<BackButton onClick={onBackClick} />
<input
ref={inputRef}
Expand All @@ -96,7 +96,7 @@ export const SearchFullScreen = ({
</div>

{!isInputNotEmpty && (
<div className="flex justify-between text-gray-400 py-2 px-4">
<div className="flex justify-between px-4 py-2 text-gray-400">
<span>์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด</span>
<button
className="text-sm text-gray-400"
Expand Down Expand Up @@ -130,7 +130,7 @@ export const SearchFullScreen = ({
/>
))
) : (
<p className="text-gray-500 flex-center text-sm mt-16">
<p className="mt-16 text-sm text-gray-500 flex-center">
์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ๋‚ด์—ญ์ด ์—†์Šต๋‹ˆ๋‹ค.
</p>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const SearchHistoryList = ({
}: SearchHistoryListProps) => {
return (
<div
className="flex items-center h-12 py-2 px-4 justify-between w-full cursor-pointer text-gray-400 hover:bg-slate-200"
className="flex items-center justify-between w-full h-12 px-4 py-2 text-gray-400 cursor-pointer hover:bg-slate-200"
onClick={() => {
onClick(place);
}}
Expand Down
14 changes: 14 additions & 0 deletions src/components/NotificationPage/NotificationAppBar.tsx
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>
);
};
2 changes: 1 addition & 1 deletion src/components/Profile/NicknameSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const NicknameSection = () => {
className="flex flex-row items-center justify-center gap-3"
>
<NicknameInput defaultValue={user?.nickname} />
{/* <button type="submit" className="border border-sample-blue rounded-sm">
{/* <button type="submit" className="border rounded-sm border-sample-blue">
๋ณ€๊ฒฝ
</button> */}
</form>
Expand Down
5 changes: 5 additions & 0 deletions src/mocks/browser.ts
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);
90 changes: 90 additions & 0 deletions src/mocks/handlers/LoginHandler.ts
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
}
);
}
)
];
Loading

0 comments on commit 2036943

Please sign in to comment.