-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
User info desktop/#81
- Loading branch information
Showing
9 changed files
with
157 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Avatar from '../../view/atom/avatar/avatar'; | ||
import Button from '../../view/atom/button/button'; | ||
import { getUserInfo } from '@/app/business/user/user.query'; | ||
import Skeleton from '../../view/atom/skeleton'; | ||
|
||
export default async function UserInfoNavigator() { | ||
const userInfo = await getUserInfo(); | ||
|
||
return ( | ||
<div className="flex flex-col items-center p-4 "> | ||
<Avatar className="w-24 h-24" alt="Profile picture" src={'/assets/profile-image.png'} /> | ||
|
||
<div className="my-5 text-lg"> | ||
<span className="font-semibold">{userInfo.studentName}</span> | ||
<span>님</span> | ||
</div> | ||
<div className="mb-3 text-sm">{userInfo.major}</div> | ||
<div className="text-sm text-gray-400">{userInfo.studentNumber}</div> | ||
|
||
<div className="mt-9"> | ||
<Button size="sm" variant="secondary" label="로그아웃" /> | ||
</div> | ||
<div className="mt-2"> | ||
<Button size="sm" variant="text" label="회원탈퇴하기" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export function UserInfoNavigatorSkeleton() { | ||
return ( | ||
<div className="flex flex-col items-center p-4 space-y-3"> | ||
<Skeleton className="h-24 w-24 rounded-full" /> | ||
<div className="space-y-6"> | ||
<Skeleton className="h-4 w-24" /> | ||
<Skeleton className="h-4 w-32" /> | ||
<Skeleton className="h-4 w-32" /> | ||
</div> | ||
</div> | ||
); | ||
} |
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,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Avatar from './avatar'; | ||
|
||
const meta = { | ||
title: 'ui/view/atom/Avatar', | ||
component: Avatar, | ||
} as Meta<typeof Avatar>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
src: './assets/profile-image.png', | ||
}, | ||
}; |
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,57 @@ | ||
'use client'; | ||
|
||
import * as React from 'react'; | ||
import * as AvatarPrimitive from '@radix-ui/react-avatar'; | ||
|
||
import { cn } from '@/app/utils/shadcn/utils'; | ||
|
||
interface AvatarProps { | ||
src: string; | ||
fallback?: React.ReactNode; | ||
alt?: string; | ||
className?: string; | ||
} | ||
|
||
export default function Avatar({ src, fallback, alt, className }: AvatarProps) { | ||
return ( | ||
<AvatarRoot className={className}> | ||
<AvatarImage src={src} alt={alt} /> | ||
<AvatarFallback>{fallback}</AvatarFallback> | ||
</AvatarRoot> | ||
); | ||
} | ||
|
||
const AvatarRoot = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> | ||
>(({ className, ...props }, ref) => ( | ||
<AvatarPrimitive.Root | ||
ref={ref} | ||
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)} | ||
{...props} | ||
/> | ||
)); | ||
AvatarRoot.displayName = AvatarPrimitive.Root.displayName; | ||
|
||
const AvatarImage = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Image>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> | ||
>(({ className, ...props }, ref) => ( | ||
<AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props} /> | ||
)); | ||
AvatarImage.displayName = AvatarPrimitive.Image.displayName; | ||
|
||
const AvatarFallback = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Fallback>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> | ||
>(({ className, ...props }, ref) => ( | ||
<AvatarPrimitive.Fallback | ||
ref={ref} | ||
className={cn( | ||
'flex h-full w-full items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800', | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)); | ||
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; |
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,5 @@ | ||
import { cn } from '@/app/utils/shadcn/utils'; | ||
|
||
export default function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) { | ||
return <div className={cn('animate-pulse rounded-md bg-slate-100 dark:bg-slate-800', className)} {...props} />; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.