Skip to content
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

feature: 프로필 페이지 제작 #109

Merged
merged 22 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
df73f2c
refactor: Modal 컴포넌트 관련 코드 리팩토링
wukdddang Nov 10, 2023
3f7e2ee
refactor: tsdoc 추가 + CSS 스타일 수정
wukdddang Nov 10, 2023
596c717
refactor: CSS 스타일 수정
wukdddang Nov 10, 2023
16dbf45
refactor: tsdoc 추가 + emotion 코드 위치 변경
wukdddang Nov 10, 2023
f901c12
refactor: Home 페이지 fragment 제거
wukdddang Nov 10, 2023
03ddec2
feature: ProfileDefault 페이지 제작
wukdddang Nov 10, 2023
2a099e9
refactor: BusinessCardContainer 공백 제거
wukdddang Nov 10, 2023
8249a88
refactor: StyleList 관련 conflict 해결
wukdddang Nov 10, 2023
1032f26
feature: 프로필 페이지 반응형 디자인 제작
wukdddang Nov 10, 2023
5ef3b9a
refactor: 사용하지 않는 파일 제거 + 반응형 디자인
wukdddang Nov 10, 2023
ea44cb5
feature: 프로필 페이지 다크모드 코드 추가
wukdddang Nov 10, 2023
7278034
feature: Modal 컴포넌트 다크모드 추가
wukdddang Nov 10, 2023
80b1ee7
Merge branch 'dev' into feature/ProfilePage
wukdddang Nov 11, 2023
d30f494
feature: 404 페이지에서 홈으로 라우팅하게 수정
wukdddang Nov 11, 2023
2dfda36
Merge branch 'dev' into feature/ProfilePage
wukdddang Nov 12, 2023
349a20a
fix: msw 2 버전으로 수정
wukdddang Nov 12, 2023
a71515d
fix: authTokens이 없어서 생기는 오류 수정
wukdddang Nov 12, 2023
ed50c8e
feature: 레이아웃 깨지는 부분 수정
wukdddang Nov 12, 2023
abf9f6c
fix: useAuthTokens 주석 처리
wukdddang Nov 12, 2023
627067e
chore: msw 2.0.5 버전으로 수정
wukdddang Nov 12, 2023
6d05df3
Merge branch 'dev' into feature/ProfilePage
from1to2 Nov 16, 2023
4db43ae
Update handlers.ts
judahhh Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (2.0.0).
* Mock Service Worker (2.0.5).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
8 changes: 8 additions & 0 deletions src/assets/icons/KakaoIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export type IconProps = {
borderRadius: number
}

/**
* @param width - 너비 (string)
* @param height - 높이 (string)
* @param iconWidth - (Optional) 아이콘 너비 (string)
* @param iconHeight - (Optional) 아이콘 높이 (string)
* @param borderRadius - (Optional) 아이콘 테두리 반지름 (string)
*/

Comment on lines +11 to +18
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

크 이제 tsdocs 장인👍👍

const KakaoIcon = ({ width, height, iconWidth, iconHeight, borderRadius }: IconProps) => (
<span
style={{
Expand Down
8 changes: 8 additions & 0 deletions src/assets/icons/NaverIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { palette } from '@/styles/palette'

import { IconProps } from './KakaoIcon'

/**
* @param width - 너비 (string)
* @param height - 높이 (string)
* @param iconWidth - (Optional) 아이콘 너비 (string)
* @param iconHeight - (Optional) 아이콘 높이 (string)
* @param borderRadius - (Optional) 아이콘 테두리 반지름 (string)
*/

const NaverIcon = ({ width, height, iconWidth, iconHeight, borderRadius }: IconProps) => (
<span
style={{
Expand Down
5 changes: 4 additions & 1 deletion src/components/common/AppHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const StyleAppHeader = styled.div<{ height?: string }>`
justify-content: flex-end;
height: ${({ height }) => height};
text-align: center;
padding: 6.5% 5% 7%;
padding: 15% 5% 7%;
`

const StyledAppHeaderLargeText = styled(Text)<Pick<AppHeaderProps, 'isDarkMode'>>`
Expand Down Expand Up @@ -75,6 +75,9 @@ const AppHeader = ({ nickname, isDarkMode, height, toggleDarkMode }: AppHeaderPr
height={49}
imgUrl={''}
margin={'0'}
style={{
cursor: 'pointer',
}}
onClick={() => {
moveFromAppHeader('profile')
}}
Expand Down
52 changes: 28 additions & 24 deletions src/components/common/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,23 @@ type AvatarProps = {
width: number | string
height: number | string
imgUrl: string
margin: string
margin?: string
onClick?: () => void
border?: string
shadow?: boolean
style?: React.CSSProperties
}

const StyledAvatar = styled.div<AvatarProps>`
width: ${(props) => (typeof props.width === 'number' ? `${props.width}px` : props.width)};
height: ${(props) => (typeof props.height === 'number' ? `${props.height}px` : props.height)};
background-image: url(${(props) => props.imgUrl});
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 50%; // 원 형태로 만들기 위함
margin: ${(props) => `${props.margin}px`};
border: ${(props) => (props.border ? props.border : 'none')};
box-shadow: ${(props) => (props.shadow ? '0px 0px 10px rgba(0, 0, 0, 0.25)' : 'none')};

@media (max-width: 280px) {
width: ${(props) =>
typeof props.width === 'number' ? `${props.width * 0.95}px` : `calc(${props.width} * 0.95)`};
height: ${(props) =>
typeof props.height === 'number'
? `${props.height * 0.95}px`
: `calc(${props.height} * 0.95)`};
}
`

/**
* `Avatar` component for displaying profile images.
* @param width - 아바타의 너비 (픽셀 또는 유효한 CSS 단위).
* @param height - 아바타의 높이 (픽셀 또는 유효한 CSS 단위).
* @param imgUrl - 아바타의 이미지 URL. 기본 이미지는 `defaultProfileImage`이다.
* @param margin - 아바타의 마진 (픽셀 또는 유효한 CSS 단위).
* @param margin - (Optional) 아바타의 마진 (픽셀 또는 유효한 CSS 단위).
* @param onClick - (Optional) 클릭 이벤트.
* @param border - (Optional) 아바타의 테두리. 기본 값은 `none`이다.
* @param shadow - (Optional) 아바타의 그림자. 기본 값은 `false`이다.
* @param props - (Optional) 추가적인 CSS 속성.
*/
const Avatar = ({
width,
Expand All @@ -52,6 +32,7 @@ const Avatar = ({
onClick,
border,
shadow = false,
...props
}: AvatarProps) => {
return (
<StyledAvatar
Expand All @@ -62,8 +43,31 @@ const Avatar = ({
margin={margin}
border={border}
onClick={onClick}
{...props}
/>
)
}

const StyledAvatar = styled.div<AvatarProps>`
width: ${(props) => (typeof props.width === 'number' ? `${props.width}px` : props.width)};
height: ${(props) => (typeof props.height === 'number' ? `${props.height}px` : props.height)};
background-image: url(${(props) => props.imgUrl});
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 50%; // 원 형태로 만들기 위함
margin: ${(props) => `${props.margin}px`};
border: ${(props) => (props.border ? props.border : 'none')};
box-shadow: ${(props) => (props.shadow ? '0px 0px 10px rgba(0, 0, 0, 0.25)' : 'none')};

@media (max-width: 280px) {
width: ${(props) =>
typeof props.width === 'number' ? `${props.width * 0.95}px` : `calc(${props.width} * 0.95)`};
height: ${(props) =>
typeof props.height === 'number'
? `${props.height * 0.95}px`
: `calc(${props.height} * 0.95)`};
}
`

export default Avatar
1 change: 1 addition & 0 deletions src/components/common/BackChevron/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const StyleBackChevron = styled.div<BackChevronProps>`
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
background-color: ${({ hasBackground, isDarkMode }) =>
isDarkMode
? hasBackground
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Buttons/IconButton/IconButtonStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type IconButtonType =

export const iconButtonStyles: Record<IconButtonType, NormalButtonStyle> = {
interest: {
width: '339px',
width: '100%',
height: 70,
fontColor: palette.WHITE,
font: 'Body_18',
Expand All @@ -25,7 +25,7 @@ export const iconButtonStyles: Record<IconButtonType, NormalButtonStyle> = {
backgroundColor: `linear-gradient(96deg, #7382F8 49.74%, #A6BCFC 93.87%);`,
},
'interest-dark': {
width: '339px',
width: '100%',
height: 70,
fontColor: palette.DARK_WHITE,
font: 'Body_18',
Expand Down
9 changes: 7 additions & 2 deletions src/components/common/Buttons/IconButton/InterestButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ type InterestButtonProps = {
isDarkMode: boolean
}

/**
* @param nickName: 닉네임, string
* @param interests: 관심사 리스트 (최대 3개), string[]
* @param isDarkMode: 다크모드 여부, boolean
*/

const InterestButton = ({ nickName, interests, isDarkMode }: InterestButtonProps) => {
const setButtonType = isDarkMode ? 'interest-dark' : 'interest'

Expand All @@ -32,7 +38,6 @@ const InterestButton = ({ nickName, interests, isDarkMode }: InterestButtonProps
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
margin: '18px 33px 18px 14px',
}}
>
<RiStarFill
Expand Down Expand Up @@ -62,7 +67,7 @@ const InterestButton = ({ nickName, interests, isDarkMode }: InterestButtonProps
<Fragment key={interest}>
{interest}
{index !== interests.length - 1 && (
<Divider width={1} height={12} margin={'0 12px'} isDarkMode={isDarkMode} />
<Divider width={'1px'} height={'12px'} margin={'0 12px'} isDarkMode={isDarkMode} />
)}
</Fragment>
))}
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/Buttons/IconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ export const StyledIconWrapper = styled.div<{
display: flex;
justify-content: center;
align-items: center;
margin: 18px 33px 18px 14px;

@media (max-width: 280px) {
margin: 2px 10px 2px 10px;
margin: 18px 14px 18px 14px;
}
`

Expand Down
15 changes: 11 additions & 4 deletions src/components/common/Divider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ import styled from '@emotion/styled'
import { palette } from '@/styles/palette'

type DividerProps = {
width: number
height: number
width: string
height: string
margin?: string
isDarkMode: boolean
}

/**
* @param width - 너비 (string)
* @param height - 높이 (string)
* @param margin - (Optional) 마진
* @param isDarkMode - 다크모드 여부
*/

export const Divider = styled.div<DividerProps>`
width: ${({ width }) => width}px;
height: ${({ height }) => height}px;
width: ${({ width }) => width};
height: ${({ height }) => height};
margin: ${({ margin }) => margin};
background-color: ${({ isDarkMode }) => (isDarkMode ? palette.GRAY500 : palette.GRAY100)};
`
2 changes: 1 addition & 1 deletion src/components/common/GradationBackground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const StyledGradationBackground = styled.div<{
isDarkMode: boolean
}>`
width: 100%;
height: 100vh;
height: 100%;
background: ${({ isDarkMode }) =>
isDarkMode
? `linear-gradient(157deg, ${palette.BLACK} 16.84%, ${palette.DARK_GRADIENT} 40%)`
Expand Down
64 changes: 38 additions & 26 deletions src/components/common/ListRow/ProfileListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,34 @@ import { FlexBox } from '@/components/common/Flexbox'
import { Text } from '@/components/common/Text'
import { palette } from '@/styles/palette'

export const StyleList = styled(FlexBox)<{
width: number
height: number
}>`
width: ${({ width }) => width}px;
height: ${({ height }) => height}px;
display: flex;
justify-content: space-between;
`

const StyleIconWrapper = styled.div<{
width: number
height: number
borderRadius?: string
backgroundColor: string
}>`
width: ${({ width }) => width}px;
height: ${({ height }) => height}px;
display: flex;
justify-content: center;
align-items: center;
border-radius: ${({ borderRadius }) => borderRadius};
background-color: ${({ backgroundColor }) => backgroundColor};
`

type ProfileListRowProps = {
firstIcon: ReactNode
title: string
additionalContent?: ReactNode | string
isDarkMode?: boolean
moveFromProfileListRow?: () => void
}

/**
* @param firstIcon - 첫번째 아이콘 (ReactNode)
* @param title - 제목 (string)
* @param additionalContent - 추가적인 내용 (string | ReactNode)
* @param isDarkMode - 다크모드 여부
* @param moveFromProfileListRow - 클릭 시 이동할 경로
*/

const ProfileListRow = ({
firstIcon,
title,
additionalContent,
isDarkMode,
moveFromProfileListRow,
}: ProfileListRowProps) => {
const isAdditionalContentString = typeof additionalContent === 'string'
const additionalContentColor = isAdditionalContentString ? palette.GRAY300 : undefined

return (
<StyleList width={308} height={38}>
<StyleList onClick={moveFromProfileListRow}>
<StyleIconWrapper
width={38}
height={38}
Expand Down Expand Up @@ -91,4 +77,30 @@ const ProfileListRow = ({
)
}

export const StyleList = styled(FlexBox)<{
width?: number
height?: number
}>`
width: ${({ width }) => (width ? `${width}px` : '100%')};
height: ${({ height }) => (height ? `${height}px` : '')};
display: flex;
justify-content: space-between;
cursor: pointer;
`

const StyleIconWrapper = styled.div<{
width: number
height: number
borderRadius?: string
backgroundColor: string
}>`
width: ${({ width }) => width}px;
height: ${({ height }) => height}px;
display: flex;
justify-content: center;
align-items: center;
border-radius: ${({ borderRadius }) => borderRadius};
background-color: ${({ backgroundColor }) => backgroundColor};
`

export default ProfileListRow
Loading