-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
학생 인증 기능 추가, 유저 정보 등록 리팩터링 #111
Changes from all commits
435c447
7ef22d8
2c013b4
a08fc86
88daf97
173b0f3
4803bac
547e58b
8222a75
e9072c2
036185d
3155768
6d4589b
4da6f49
745a0fc
16fd270
9714d3f
e82e13a
fb20f2d
9b5d2dd
d01e634
301d1a3
4f264bc
33c1f2b
166139d
7e6f4f2
303649c
2d1eb3a
234174d
6cff1a4
088425d
437ac6f
210b1ca
22a715b
5a374a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,12 @@ import { useEffect } from 'react'; | |
interface DelayedRedirectionProps { | ||
children: ReactNode; | ||
to: UrlObject | string; | ||
seconds: number; | ||
seconds?: number; | ||
replace?: boolean; | ||
} | ||
|
||
const DelayedRedirection = (props: DelayedRedirectionProps) => { | ||
const { children, to, seconds, replace = false } = props; | ||
const { children, to, seconds = 3, replace = false } = props; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좋습니다! |
||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,7 @@ export const BasicExample = () => { | |
})} | ||
</div> | ||
|
||
{/* 이 모달은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
<GlobalModal /> | ||
{/* `GlobalModal`은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
</> | ||
); | ||
}; | ||
|
@@ -86,8 +85,7 @@ export const OnlyCloseWhenActionIsPressed = () => { | |
<> | ||
<Button onClick={handleOpenModal}>트리거 버튼</Button> | ||
|
||
{/* 이 모달은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
<GlobalModal /> | ||
{/* `GlobalModal`은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
</> | ||
); | ||
}; | ||
|
@@ -123,8 +121,7 @@ export const ModalInModal = () => { | |
<Button onClick={handleOpenModal}>트리거 버튼</Button> | ||
</div> | ||
|
||
{/* 이 모달은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
<GlobalModal /> | ||
{/* `GlobalModal`은 `_app.tsx`에서 한번만 렌더링합니다. */} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 스토리북의 |
||
</> | ||
); | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { default as MainLayout } from './MainLayout'; | ||
export { default as LunchLayout } from './LunchLayout'; | ||
export { default as UserRegisterLayout } from './UserRegisterLayout'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import type { UserInfo } from '~/services/member'; | ||
|
||
import { userInfo } from '~/mocks/handlers/member/data'; | ||
import { SsafyTrack } from '~/services/member'; | ||
import { disableArgs } from '~/stories/utils'; | ||
|
||
import NameCard from './index'; | ||
|
||
const meta: Meta<typeof NameCard> = { | ||
title: 'NameCard', | ||
component: NameCard, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
...disableArgs(['userInfo']), | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type NameCardStory = StoryObj<NameCardStoryProps>; | ||
interface NameCardStoryProps { | ||
withBackground?: boolean; | ||
track: SsafyTrack; | ||
nickname: string; | ||
} | ||
|
||
export const Default: NameCardStory = { | ||
args: { | ||
withBackground: false, | ||
track: SsafyTrack.EMBEDDED, | ||
nickname: 'Kimee', | ||
}, | ||
argTypes: { | ||
track: { | ||
control: 'radio', | ||
options: Object.values(SsafyTrack), | ||
}, | ||
}, | ||
render: (args) => { | ||
const { withBackground, track, nickname } = args; | ||
const user: UserInfo = userInfo.certifiedSsafyUserInfo; | ||
user.nickname = nickname; | ||
user.ssafyInfo.majorTrack = track; | ||
|
||
return <NameCard userInfo={user} withBackground={withBackground} />; | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { UserInfo } from '~/services/member'; | ||
|
||
import { css } from '@emotion/react'; | ||
|
||
import Name from '~/components/Name'; | ||
import { fontCss, inlineFlex, palettes } from '~/styles/utils'; | ||
|
||
export interface NameCardProps { | ||
userInfo: UserInfo; | ||
withBackground?: boolean; | ||
} | ||
|
||
const NameCard = (props: NameCardProps) => { | ||
const { userInfo, withBackground = false } = props; | ||
const { ssafyInfo: { campus, semester } = {} } = userInfo; | ||
const hasSsafyInfo = campus && semester; | ||
|
||
return ( | ||
<div css={[selfCss, withBackground && backgroundCss]}> | ||
<Name userInfo={userInfo} size="lg" /> | ||
{hasSsafyInfo && ( | ||
<div css={ssafyInfoCss}>{formatSsafyInfo(semester, campus)}</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
const formatSsafyInfo = (year: number, campus: string) => { | ||
return `${campus}캠퍼스 SSAFY ${year}기`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 별건 아닌 부분이지만 아마 year 대신 semester를 사용해서 용어를 맞춰놔도 좋을 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저번에 말씀드렸듯이 의미상으로 |
||
}; | ||
|
||
export default NameCard; | ||
|
||
const selfCss = css( | ||
{ | ||
padding: '6px 10px', | ||
color: palettes.white, | ||
borderRadius: 10, | ||
}, | ||
fontCss.family.auto, | ||
inlineFlex('flex-start', 'center') | ||
); | ||
|
||
const ssafyInfoCss = css(fontCss.style.B16); | ||
|
||
const backgroundCss = css({ | ||
backgroundColor: palettes.white, | ||
color: palettes.font.grey, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Meta } from '@storybook/react'; | ||
|
||
import { userInfo } from '~/mocks/handlers/member/data'; | ||
import { PageLayout } from '~/stories/Layout'; | ||
import { disableArgs } from '~/stories/utils'; | ||
|
||
import PreviewCertifiedMyInfo from './index'; | ||
|
||
const meta: Meta<typeof PreviewCertifiedMyInfo> = { | ||
title: 'PreviewCertifiedMyInfo', | ||
component: PreviewCertifiedMyInfo, | ||
tags: ['autodocs'], | ||
decorators: [ | ||
(Story) => ( | ||
<PageLayout> | ||
<Story /> | ||
</PageLayout> | ||
), | ||
], | ||
argTypes: { | ||
...disableArgs(['userInfo']), | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
args: { | ||
userInfo: userInfo.certifiedSsafyUserInfo, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { UserInfo } from '~/services/member'; | ||
|
||
import { css } from '@emotion/react'; | ||
|
||
import { SsafyIcon, TrackSize } from '~/components/Common'; | ||
import NameCard from '~/components/NameCard'; | ||
import { flex, fontCss, palettes } from '~/styles/utils'; | ||
|
||
interface PreviewCertifiedMyInfoProps { | ||
userInfo: UserInfo; | ||
} | ||
|
||
const PreviewCertifiedMyInfo = (props: PreviewCertifiedMyInfoProps) => { | ||
const { userInfo } = props; | ||
|
||
return ( | ||
<div css={selfCss}> | ||
<div css={topLayerCss}> | ||
<p>SSAFY 캐릭터 프로필이</p> | ||
<p>생성되었습니다</p> | ||
<p | ||
css={[ | ||
fontCss.style.R16, | ||
{ color: palettes.primary.default, marginTop: 18 }, | ||
]} | ||
> | ||
SSAFY만의 커뮤니티를 이용해보세요 | ||
</p> | ||
</div> | ||
<div css={bottomLayerCss}> | ||
<SsafyIcon.Track | ||
size={TrackSize.LG2} | ||
name={userInfo?.ssafyInfo?.majorTrack} | ||
/> | ||
|
||
<NameCard userInfo={userInfo} withBackground /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PreviewCertifiedMyInfo; | ||
|
||
const selfCss = css( | ||
{ minHeight: '100vh', padding: '40px 0' }, | ||
flex('center', 'center', 'column', 120) | ||
); | ||
|
||
const topLayerCss = css({ textAlign: 'center' }, fontCss.style.B28); | ||
|
||
const bottomLayerCss = css(flex('center', '', 'column', 26)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
트랙이 없는경우 서버에서 값이
null
로 넘어오기 때문에 추가