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

My page skeleton/#102 #103

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
11 changes: 7 additions & 4 deletions app/(sub-page)/my/components/my-result-container.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import UserCreditResult from '@/app/ui/user/user-credit-result';
import UserCreditResult from '@/app/ui/user/user-credit-result/user-credit-result';
import UserCreditResultSkeleton from '@/app/ui/user/user-credit-result/user-credit-result-skeleton';
import Button from '@/app/ui/view/atom/button/button';
import Link from 'next/link';
import React from 'react';
import React, { Suspense } from 'react';

export default function MyResultContainer() {
return (
<div className="flex flex-col justify-center gap-10">
<div className="flex flex-col justify-center gap-10 px-2 lg:px-0">
<p className="font-bold sm:text-3xl text-2xl ml-1 sm:ml-0">๋งˆ์ดํŽ˜์ด์ง€</p>
<UserCreditResult />
<Suspense fallback={<UserCreditResultSkeleton />}>
<UserCreditResult />
</Suspense>
<div className="flex justify-center">
<Link href="/result">
<Button label="์ˆ˜๊ฐ•ํ˜„ํ™ฉ ์ž์„ธํžˆ ๋ณด๊ธฐ" variant="primary" size="xs" />
Expand Down
5 changes: 4 additions & 1 deletion app/(sub-page)/my/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Drawer from '@/app/ui/view/molecule/drawer/drawer';
import { DIALOG_KEY } from '@/app/utils/key/dialog-key.util';
import { Suspense } from 'react';
import MyResultContainer from './components/my-result-container';
import TakenLectureSkeleton from '@/app/ui/lecture/taken-lecture/taken-lecture-skeleton';

export default function MyPage() {
return (
Expand All @@ -19,7 +20,9 @@ export default function MyPage() {
</div>
<div className="w-full lg:w-[70%] lg:px-[20px] pt-12 pb-2 flex flex-col gap-12">
<MyResultContainer />
<TakenLecture />
<Suspense fallback={<TakenLectureSkeleton />}>
<TakenLecture />
</Suspense>
</div>
</ContentContainer>
<Drawer drawerKey={DIALOG_KEY.LECTURE_SEARCH}>
Expand Down
1 change: 1 addition & 0 deletions app/ui/lecture/taken-lecture/taken-lecture-constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TAKEN_LECTURE_TABLE_HEADER_INFO = ['์ˆ˜๊ฐ•๋…„๋„', '์ˆ˜๊ฐ•ํ•™๊ธฐ', '๊ณผ๋ชฉ์ฝ”๋“œ', '๊ณผ๋ชฉ๋ช…', 'ํ•™์ '];
7 changes: 3 additions & 4 deletions app/ui/lecture/taken-lecture/taken-lecture-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { useAtom } from 'jotai';
import { deleteTakenLecture } from '@/app/business/lecture/taken-lecture.command';
import { useToast } from '../../view/molecule/toast/use-toast';
import Responsive from '../../responsive';

const headerInfo = ['์ˆ˜๊ฐ•๋…„๋„', '์ˆ˜๊ฐ•ํ•™๊ธฐ', '๊ณผ๋ชฉ์ฝ”๋“œ', '๊ณผ๋ชฉ๋ช…', 'ํ•™์ '];
import { TAKEN_LECTURE_TABLE_HEADER_INFO } from './taken-lecture-constant';

export default function TakenLectureList() {
const [takenLectures, setTakenLectures] = useAtom(takenLectureAtom);
Expand Down Expand Up @@ -36,7 +35,7 @@ export default function TakenLectureList() {
<>
<Responsive minWidth={1024}>
<Table
headerInfo={headerInfo}
headerInfo={TAKEN_LECTURE_TABLE_HEADER_INFO}
data={optimisticLecture}
renderActionButton={(id: number) => (
<DeleteTakenLectureButton lectureId={id} onDelete={handleDeleteTakenLecture} />
Expand All @@ -45,7 +44,7 @@ export default function TakenLectureList() {
</Responsive>
<Responsive maxWidth={1023}>
<Table
headerInfo={headerInfo}
headerInfo={TAKEN_LECTURE_TABLE_HEADER_INFO}
data={optimisticLecture}
onSwipeAction={handleDeleteTakenLecture}
swipeable={true}
Expand Down
16 changes: 16 additions & 0 deletions app/ui/lecture/taken-lecture/taken-lecture-skeleton.tsx
Copy link
Member

Choose a reason for hiding this comment

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

ํŒŒ์ผ ๋ช…์ด ๊ธฐ์กด ๋„ค์ด๋ฐ๊ณผ ์กฐ๊ธˆ ๋‹ค๋ฅธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ํ†ต์ผ์ด ํ•„์š”ํ•  ๊ฒƒ ๊ฐ™์•„์š”

Copy link
Member Author

Choose a reason for hiding this comment

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

๊ธฐ์กด ๋„ค์ด๋ฐ์ด ์–ด๋–ค ๊ฑฐ ๋ง์”€ํ•˜์‹œ๋Š” ์ง€ ์•Œ๋ ค์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”?

Copy link
Member

Choose a reason for hiding this comment

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

taken-lecture.skeleton.tsx ํ˜•์‹์„ ์˜๋ฏธํ•˜๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค

Copy link
Member Author

Choose a reason for hiding this comment

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

์•„ํ•˜ ๋‹ค๋ฅธ ๋ถ„๋“ค์€ taken-lecture.skeleton.tsx ํ˜•์‹์œผ๋กœ ํ•˜์…จ๋„ค์š”! ์ด์ œ ๋ดค์Šต๋‹ˆ๋‹ค ํ˜น์‹œ ๊ทธ๋ ‡๋‹ค๋ฉด .skeleton.tsx๋กœ ๋„ค์ด๋ฐ์„ ์ง€์œผ์‹  ์ด์œ ๊ฐ€ ์žˆ์œผ์‹ค๊นŒ์š”?? skeleton์€ atom ๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ์ธ๋ฐ .business.ts๋‚˜ .type.ts ์ฒ˜๋Ÿผ ๋„ค์ด๋ฐ์„ ์ง€์„ ํ•„์š”๊ฐ€ ์žˆ๋‚˜ ์‹ถ๋„ค์š”! ์ €ํฌ๊ฐ€ result.dialog.tsx๋กœ ๋„ค์ด๋ฐ์„ ์ง“์ง€ ์•Š๊ณ  result-dialog.tsx ๋กœ ์ง“๋Š” ๊ฒƒ์ฒ˜๋Ÿผ์š”!

Copy link
Member

Choose a reason for hiding this comment

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

์ €๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋„ค์ด๋ฐ์€ ์ €ํฌ ํŒ€ ์•ˆ์—์„œ๋งŒ ํ•ฉ์˜๋˜๋ฉด ๋˜๋Š” ๋ถ€๋ถ„์ด๋ผ๊ณ  ์ƒ๊ฐ์„ ํ•˜๋Š”๋ฐ์š”. ์ œ๊ฐ€ skeleton์„ ๊ฐœ๋ฐœํ•  ๋‹น์‹œ์—๋Š” ์ด๋ฏธ ํ•ด๋‹น ๋„ค์ด๋ฐ์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์—ˆ์œผ๋ฉฐ, ํ•ด๋‹น ๋„ค์ด๋ฐ ๋ณ„๋„๋กœ ๋ถ€์ž์—ฐ์Šค๋Ÿฝ๋‹ค๋Š” ์ƒ๊ฐ์„ ํ•˜์ง€ ์•Š์•„์„œ ์ €๋„ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉํ•œ ๊ฒƒ์œผ๋กœ ๊ธฐ์–ต์ด ๋‚ฉ๋‹ˆ๋‹ค. ํ•ด์„œ ์„ฑํ›ˆ ์„ ๋ฐฐ์˜ ์˜๊ฒฌ๋„ ๊ถ๊ธˆํ•˜๋„ค์š”.

์ œ๊ฐ€ ๋ถ€์ž์—ฐ์Šค๋Ÿฝ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€ ์•Š์•˜๋˜ ์ด์œ ๋Š” taken-lecture์˜ skeleton์„ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ๊ฐ€ ํ‘œํ˜„ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. taken-lecture์˜ storybook์„ taken-lecture.storiesํ‘œ๊ธฐ๋ฒ•์œผ๋กœ ์ž‘์„ฑํ•˜๋“ฏ taken-lecture์— ๋Œ€ํ•œ skeleton component๋ผ๊ณ  ์ƒ๊ฐํ•ด์„œ ํ•ด๋‹น ๋„ค์ด๋ฐ์ด ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์™€๋‹ฟ์•˜๋˜ ๊ฒƒ ๊ฐ™๋„ค์š”.

result-dialog.tsx์€ result์˜ dialog๋กœ์„œ์˜ ์˜๋ฏธ๋ณด๋‹ค๋Š” content๋ฅผ ๋‹ด๋‹นํ•˜๋Š” component์ด๊ธฐ ๋•Œ๋ฌธ์— ๋™์ผํ•œ ๋Œ€์ƒ์œผ๋กœ ๋ณด๊ธฐ๋Š” ์–ด๋ ต๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“œ๋Š”๋ฐ, ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

Copy link
Member Author

Choose a reason for hiding this comment

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

์ €๋Š” skeleton์„ ๋‹จ์ˆœํžˆ ์ปดํฌ๋„ŒํŠธ๋กœ๋งŒ ๋ณด๊ณ  , ์–ธ๋‹ˆ๋Š” skeleton์„ storybook, business, command ์ฒ˜๋Ÿผ ์–ด๋–ค ๊ฒƒ์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ์ข…๋ฅ˜๋‚˜ ๊ธฐ๋Šฅ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋˜ ๊ฒƒ ๊ฐ™๋„ค์š”!

dialog๊ฐ€ dialog ์ž์ฒด์˜ ์—ญํ• ์€ ๊ฐ•ํ•˜์ง€ ์•Š์€๋ฐ ์ด์— ๋น„ํ•ด skeleton์€ skeleton ์ž์ฒด ์—ญํ• ์ด ๊ฐ•ํ•˜๋‹ค๋Š” ๋ง์”€ ์ €๋„ ๋™์˜ํ•ฉ๋‹ˆ๋‹ค! ๊ทธ๋Ÿฌํ•œ ์ด์œ ๋กœ .skeleton.tsx๋ฅผ ์‚ฌ์šฉํ•  ๊ฑฐ๋ผ๋ฉด atom ํด๋”๊ฐ€ ์•„๋‹Œ util ํด๋”๊ฐ€ ์ข€ ๋” ์ ํ•ฉํ•˜์ง€ ์•Š์„๊นŒํ•˜๋„ค์š” ์ด์— ๋Œ€ํ•ด์„œ๋Š” ํ˜น์‹œ ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

Copy link
Member

Choose a reason for hiding this comment

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

๊ธฐ์กด์˜ Skeleton atom component๊ฐ€ util ํด๋”๋กœ์˜ ์ด๋™์„ ํ†ตํ•ด์„œ ๋„๊ตฌ์  ์ฐจ์›์˜ ์˜๋ฏธ๋ฅผ ๋” ๊ฐ•ํ•˜๊ฒŒ ๋‚˜ํƒ€๋‚ผ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“œ๋„ค์š”. ์ข‹์Šต๋‹ˆ๋‹ค.

Copy link
Member Author

Choose a reason for hiding this comment

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

638ecf1
๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Skeleton from '../../view/atom/skeleton';
import { TableHeader } from '../../view/molecule/table/table-header';
import { TAKEN_LECTURE_TABLE_HEADER_INFO } from './taken-lecture-constant';
import TakenLectureLabel from './taken-lecture-label';

export default function TakenLectureSkeleton() {
return (
<div className="flex flex-col gap-2.5 w-full">
<TakenLectureLabel />
<TableHeader headerInfo={TAKEN_LECTURE_TABLE_HEADER_INFO} cols={6} />
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="rounded-xl w-full h-12" />
))}
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import Skeleton from '../../view/atom/skeleton';

export default function UserCreditResultSkeleton() {
return <Skeleton className="min-h-20 rounded-lg py-1 px-8 gap-3" />;
}
2 changes: 1 addition & 1 deletion app/ui/view/atom/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +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} />;
return <div className={cn('animate-pulse rounded-md bg-gray-100', className)} {...props} />;
}
Loading