-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [feat] Login UI 구현 * [feat] ContentLayout UI 구현 - 로그인 화면, 온보딩과 같은 싱글 컨텐츠 레이아웃 UI 구현 * [feat] LoginPage UI 구현 * [feat] signin api 기능 및 msw 구현 * [feat] google oauth 로그인 후 헤더 UI 구현 * [feat] recoil 관련 storybook 설정 * [feat] 커먼성 UserInfo UI 구현 - User 의 정보를 나타내는 UserInfo 컴포넌트 구현 * [feat] 로그인 성공후 유저 정보를 클릭 시 나타나는 UserMenu UI 구현 * [feat] User UI 클릭 시 유저메뉴 보이는 기능 구현 * [feat] recoil localstorage effect 기능 구현 - 로그인 성공시 해당 user 정보를 localstorage 에 저장하여 영구적으로 사용할 수 있도록 설정 * [feat] google oauth redirect 기능 구현 * [fix] 🐛 nextjs Hydration failed error 수정 - recoil effect 로 localstorage 에 user 값이 있냐 없냐에 따라 로그인 상태 여부를 판단하는데 해당 기능을 추가할 때 Hydration failed 에러 발생 => 유추한 결과 window undefined 를 판단하는데 이때 초기 렌더링 UI 와 달라 발생하는 거 같음 - 해당 URL 참고하여 수정 https://stackoverflow.com/questions/71706064/react-18-hydration-failed-because-the-initial-ui-does-not-match-what-was-render/71797054#71797054 * [feat] api 없는 로그아웃 기능 구현 * [fix] 🐛 recoil 0.7.6 Duplicate atom key error 수정 - atomKey 가 고유한데 해당 이슈 발생해서 찾아보니 recoil 0.7.6 이슈 같음 https://stackoverflow.com/questions/65506656/recoil-duplicate-atom-key-in-nextjs facebookexperimental/Recoil#733 (comment) * [refactor] type 수정 * [feat] env-sample 에 NEXT_PUBLIC_GOOGLE_CLIENT_ID 형식 추가 * [chore] chromatic 배포를 위한 환경설정 값 추가 * [chore] 실수로 올린 .env 파일 제거 * [chore] 실수로 변경한 config 설정 수정 * [refactor] 코드리뷰 적용 - auth Type 수정 - resetUser 네이밍 수정 - UserInfo 컴포넌트 default type 수정 - 불필요한 코드 제거 * [refactor] login page 구조 변경
- Loading branch information
1 parent
96aabdb
commit 403b016
Showing
36 changed files
with
596 additions
and
10 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
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,30 @@ | ||
import { ResponseComposition, RestContext, RestRequest, rest } from 'msw'; | ||
|
||
import { PostSigninResponse } from '@src/apis/auth'; | ||
import { BASE_URL } from '@src/configs/axios'; | ||
|
||
const NEW_MEMBER = false; | ||
const MEMBER = true; | ||
|
||
const AUTH_DATA = { | ||
isMember: MEMBER, | ||
jwtTokens: { | ||
accessToken: 'access-token', | ||
refreshToken: 'refresh-token', | ||
}, | ||
}; | ||
|
||
const signin = (req: RestRequest, res: ResponseComposition, ctx: RestContext) => { | ||
return res( | ||
ctx.status(201), | ||
ctx.json<PostSigninResponse>({ | ||
code: 'SUCCESS', | ||
message: '성공', | ||
data: AUTH_DATA, | ||
}), | ||
); | ||
}; | ||
|
||
export const authHandler = [ | ||
rest.post(`${BASE_URL}/auth/signin`, signin), // | ||
]; |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { authHandler } from './auth'; | ||
import { commentHandler } from './comment'; | ||
import { topicDetailHandler } from './topic'; | ||
|
||
export const handlers = [ | ||
...topicDetailHandler, // | ||
...authHandler, // | ||
...topicDetailHandler, | ||
...commentHandler, | ||
]; |
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,25 @@ | ||
import axios from 'axios'; | ||
|
||
import { BaseResponse } from '.'; | ||
|
||
export interface Auth { | ||
isMember: boolean; | ||
jwtTokens: { | ||
accessToken: string; | ||
refreshToken: string; | ||
}; | ||
} | ||
|
||
/** | ||
* 로그인 | ||
*/ | ||
export type PostSigninResponse = BaseResponse<Auth>; | ||
export const signin = async (authCode: string) => { | ||
const res = await axios.post<PostSigninResponse>(`/auth/signin`, null, { | ||
headers: { | ||
'auth-code': authCode, | ||
}, | ||
}); | ||
|
||
return res.data.data; | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
14 changes: 14 additions & 0 deletions
14
src/components/common/Header/UserMenu/UserMenu.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,14 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
import UserMenu from './UserMenu'; | ||
|
||
export default { | ||
title: 'common/UserMenu', | ||
component: UserMenu, | ||
args: {}, | ||
} as ComponentMeta<typeof UserMenu>; | ||
|
||
const Template: ComponentStory<typeof UserMenu> = ({ ...args }) => <UserMenu {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = {}; |
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,45 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import theme from '@src/styles/theme'; | ||
|
||
export const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 227px; | ||
height: 182px; | ||
box-shadow: 0px 4px 30px 5px rgba(0, 0, 0, 0.15); | ||
border-radius: 8px; | ||
`; | ||
|
||
export const UserItem = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 16px; | ||
height: 76px; | ||
border-radius: 8px 8px 0 0; | ||
background: ${theme.color.G4}; | ||
&:hover { | ||
background: ${theme.color.G5}; | ||
cursor: pointer; | ||
} | ||
`; | ||
|
||
export const MenuItem = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
padding: 16px; | ||
height: 53px; | ||
background: ${theme.color.G4}; | ||
&:hover { | ||
background: ${theme.color.G5}; | ||
cursor: pointer; | ||
} | ||
&:last-child { | ||
border-radius: 0 0 8px 8px; | ||
} | ||
`; |
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,26 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import Icon from '@src/components/common/Icon'; | ||
import UserInfo from '@src/components/common/UserInfo'; | ||
|
||
import * as S from './UserMenu.styles'; | ||
|
||
interface Props { | ||
onLogout: () => void; | ||
} | ||
const UserMenu: FC<Props> = (props) => { | ||
const { onLogout } = props; | ||
|
||
return ( | ||
<S.Wrapper> | ||
<S.UserItem> | ||
<UserInfo /> | ||
<Icon name="ArrowRight" size={24} /> | ||
</S.UserItem> | ||
<S.MenuItem>문의하기</S.MenuItem> | ||
<S.MenuItem onClick={onLogout}>로그아웃</S.MenuItem> | ||
</S.Wrapper> | ||
); | ||
}; | ||
|
||
export default UserMenu; |
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 @@ | ||
export { default } from './UserMenu'; |
16 changes: 16 additions & 0 deletions
16
src/components/common/SingleContentLayout/SingleContentLayout.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,16 @@ | ||
import { ComponentStory } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import SingleContentLayout from '.'; | ||
|
||
export default { | ||
component: SingleContentLayout, | ||
title: 'common/SingleContentLayout', | ||
}; | ||
|
||
const Template: ComponentStory<typeof SingleContentLayout> = (args) => <SingleContentLayout {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
children: '컨텐츠', | ||
}; |
7 changes: 7 additions & 0 deletions
7
src/components/common/SingleContentLayout/SingleContentLayout.styles.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,7 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const Wrapper = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 206px; | ||
`; |
18 changes: 18 additions & 0 deletions
18
src/components/common/SingleContentLayout/SingleContentLayout.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,18 @@ | ||
import React, { FC, PropsWithChildren } from 'react'; | ||
|
||
import Header from '@src/components/common/Header'; | ||
|
||
import * as S from './SingleContentLayout.styles'; | ||
|
||
const ContentLayout: FC<PropsWithChildren> = (props) => { | ||
const { children } = props; | ||
|
||
return ( | ||
<> | ||
<Header /> | ||
<S.Wrapper>{children}</S.Wrapper> | ||
</> | ||
); | ||
}; | ||
|
||
export default ContentLayout; |
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 @@ | ||
export { default } from './SingleContentLayout'; |
Oops, something went wrong.