Skip to content

Commit 7d6f4aa

Browse files
authored
Merge pull request #18 from Leets-Official/17-feat/Priofile-컴포넌트-제작
[Feat] Profile 컴포넌트 개발 및 디자인
2 parents e783e5f + ae9028b commit 7d6f4aa

6 files changed

Lines changed: 85 additions & 2 deletions

File tree

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ const config: StorybookConfig = {
1111
],
1212
framework: '@storybook/react-vite',
1313
};
14-
export default config;
14+
export default config;

public/profile-sample.jpg

6.05 KB
Loading

public/site.webmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"theme_color": "#ffffff",
1919
"background_color": "#ffffff",
2020
"display": "standalone"
21-
}
21+
}

src/pages/playground.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import { Button } from '@shared/ui/Button/Button';
22
import { Card } from '@shared/ui/Card/Card';
33
import { Checkbox } from '@shared/ui/Checkbox/Checkbox';
4+
import { Profile } from '@shared/ui/Profile/Profile';
45
import { RadioButton } from '@shared/ui/RadioButton/RadioButton';
56

67
export default function Playground() {
78
return (
89
<div className="flex flex-col gap-6 p-8">
910
<h1 className="typo-title-2">UI Playground</h1>
1011

12+
{/* Button */}
1113
<section className="flex flex-col gap-4">
1214
<h2 className="typo-body-1">Button</h2>
1315
<p className="typo-caption-2 text-gray-600">
1416
Hover와 Focus 상태를 확인하려면 마우스를 올리거나 Tab 키로 포커스를 이동하세요.
1517
</p>
18+
1619
<div className="flex flex-col gap-4">
1720
<div className="flex items-center gap-4">
1821
<span className="typo-caption-1 w-24">Fill</span>
@@ -21,6 +24,7 @@ export default function Playground() {
2124
Disabled
2225
</Button>
2326
</div>
27+
2428
<div className="flex items-center gap-4">
2529
<span className="typo-caption-1 w-24">Outline</span>
2630
<Button variant="outline">Default</Button>
@@ -31,6 +35,7 @@ export default function Playground() {
3135
</div>
3236
</section>
3337

38+
{/* Checkbox */}
3439
<section className="flex flex-col gap-4">
3540
<h2 className="typo-body-1">Checkbox</h2>
3641
<div className="flex flex-col gap-2">
@@ -41,6 +46,7 @@ export default function Playground() {
4146
</div>
4247
</section>
4348

49+
{/* Radio Button */}
4450
<section className="flex flex-col gap-4">
4551
<h2 className="typo-body-1">Radio Button</h2>
4652
<div className="flex flex-col gap-2">
@@ -50,6 +56,38 @@ export default function Playground() {
5056
<RadioButton checked disabled label="Selected + Disabled" />
5157
</div>
5258
</section>
59+
60+
{/* Profile */}
61+
<section className="flex flex-col gap-4">
62+
<h2 className="typo-body-1">Profile</h2>
63+
<p className="typo-caption-2 text-gray-600">
64+
size variant 및 placeholder 상태를 확인합니다.
65+
</p>
66+
67+
<div className="flex items-center gap-10">
68+
<div className="flex flex-col items-center gap-2">
69+
<Profile size="sm" imageUrl="/profile-sample.jpg" />
70+
<span className="typo-caption-2">Small Image</span>
71+
</div>
72+
73+
<div className="flex flex-col items-center gap-2">
74+
<Profile size="lg" imageUrl="/profile-sample.jpg" />
75+
<span className="typo-caption-2">Large Image</span>
76+
</div>
77+
78+
<div className="flex flex-col items-center gap-2">
79+
<Profile size="sm" />
80+
<span className="typo-caption-2 text-gray-500">Small Placeholder</span>
81+
</div>
82+
83+
<div className="flex flex-col items-center gap-2">
84+
<Profile size="lg" />
85+
<span className="typo-caption-2 text-gray-500">Large Placeholder</span>
86+
</div>
87+
</div>
88+
</section>
89+
90+
{/* Card */}
5391
<section className="flex flex-col gap-4">
5492
<h2 className="typo-body-1">Card</h2>
5593

src/shared/ui/Profile/Profile.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { profileVariants } from './Profile.variants';
2+
import type { ComponentPropsWithoutRef } from 'react';
3+
import type { VariantProps } from 'tailwind-variants';
4+
5+
export type ProfileProps = ComponentPropsWithoutRef<'div'> &
6+
VariantProps<typeof profileVariants> & {
7+
imageUrl?: string;
8+
};
9+
10+
export const Profile = ({ size, imageUrl, className, style, ...props }: ProfileProps) => {
11+
return (
12+
<div
13+
{...props}
14+
className={profileVariants({ size, className })}
15+
style={{
16+
...(imageUrl && { backgroundImage: `url(${imageUrl})` }),
17+
...style,
18+
}}
19+
/>
20+
);
21+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { tv } from 'tailwind-variants';
2+
3+
export const profileVariants = tv({
4+
base: [
5+
'relative',
6+
'flex items-center justify-center',
7+
'overflow-hidden',
8+
9+
'rounded-full',
10+
'bg-[var(--color-gray-200)]',
11+
'bg-center bg-cover bg-no-repeat',
12+
],
13+
14+
variants: {
15+
size: {
16+
sm: ['w-[44px]', 'h-[44px]'],
17+
lg: ['w-[152px]', 'h-[152px]'],
18+
},
19+
},
20+
21+
defaultVariants: {
22+
size: 'sm',
23+
},
24+
});

0 commit comments

Comments
 (0)