Skip to content

Commit 7f7c069

Browse files
authored
유저 프로필 컴포넌트 (#110)
* fix: box이름을 headerbox로 변경 * feat: TILOG_AUTH환경변수 추가 * feat: getme 커스텀훅 작성 * fix: 이벤트리스너로 리팩터링 및 로직 분리 * fix: 로그아웃 로직 수정 * feat: callback page 작성 * fix: 헤더 디자인 수정 * fix: 리덕스 삭제 * fix: 리덕스 삭제 * fix: code smell * fix: 이미지 컴포넌트 원자로 이동 no-image 컴포넌트 작성 인터페이스 작성 * feat: 유저 이름 컴포넌트 작성 인터페이스 작성 * feat: 유저 프로필 컴포넌트 작성 인터페이스 작성
1 parent 39d36d5 commit 7f7c069

File tree

11 files changed

+96
-27
lines changed

11 files changed

+96
-27
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Image from "next/image";
2+
3+
import NoUserImage from "@Components/atom/images/no-image/NoUserImage";
4+
5+
import { UserImageProps } from "@Components/atom/images/interface/userImageProps";
6+
7+
const UserImage = ({ avatar, cursor = false }: UserImageProps) => {
8+
if (!avatar) return <NoUserImage cursor={cursor} />;
9+
return (
10+
<Image
11+
className={`rounded-full ${cursor ? "cursor-pointer" : ""} `}
12+
layout="fill"
13+
alt="avatar"
14+
src={avatar}
15+
/>
16+
);
17+
};
18+
export default UserImage;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {
2+
UserImageProps,
3+
NoUserImageProps,
4+
} from "@Components/atom/images/interface/userImageProps";
5+
6+
export type { UserImageProps, NoUserImageProps };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface UserImageProps {
2+
avatar: string | null;
3+
cursor?: boolean;
4+
}
5+
6+
export interface NoUserImageProps {
7+
cursor?: boolean;
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { NoUserImageProps } from "@Components/atom/images/interface/userImageProps";
2+
3+
const NoUserImage = ({ cursor = false }: NoUserImageProps) => {
4+
return (
5+
<div
6+
className={`${
7+
cursor ? "cursor-pointer" : ""
8+
} w-full h-full rounded-full dark:bg-neutral-100 bg-neutral-700`}
9+
/>
10+
);
11+
};
12+
13+
export default NoUserImage;

src/components/atom/user/UserName.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import UserNameProp from "@Components/atom/user/interface/userNameProp";
2+
3+
const UserName = ({ userNameStyle, children }: UserNameProp) => (
4+
<span
5+
className={`ml-3 text-xl font-semibold text-neutral-600 dark:text-neutral-50 font-eng-sub-font-1 ${userNameStyle}`}
6+
>
7+
{children}
8+
</span>
9+
);
10+
11+
export default UserName;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import UserNameProp from "@Components/atom/user/interface/userNameProp";
2+
3+
export type { UserNameProp };
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ReactNode } from "react";
2+
3+
export default interface UserNameProp {
4+
userNameStyle?: string;
5+
children: ReactNode;
6+
}

src/components/molecules/images/UserImage.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import UserImage from "@Components/atom/images/UserImage";
2+
import UserName from "@Components/atom/user/UserName";
3+
import { ProfileUserProps } from "@Components/molecules/user/interface";
4+
5+
const UserProfile = ({
6+
cursor,
7+
userNameStyle,
8+
UserImageStyle,
9+
avatar,
10+
children,
11+
}: ProfileUserProps) => {
12+
return (
13+
<div className="flex items-center">
14+
<div className={`relative ${UserImageStyle}`}>
15+
<UserImage cursor={cursor} avatar={avatar} />
16+
</div>
17+
<UserName userNameStyle={userNameStyle}>{children}</UserName>
18+
</div>
19+
);
20+
};
21+
22+
export default UserProfile;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import ProfileUserProps from "@Components/molecules/user/interface/profileUserProps";
2+
3+
export type { ProfileUserProps };

0 commit comments

Comments
 (0)