Skip to content

Commit 198cfde

Browse files
authored
Feat/47/todo card component (#105)
* ๐Ÿ“ฆ chore: dayjs ํŒจํ‚ค์ง€ ์ถ”๊ฐ€ * โœจ feat: ๋‚ ์งœ ํฌ๋งคํŒ… ํ•จ์ˆ˜ ์ถ”๊ฐ€ * ๐Ÿ’„ feat: ํ• ์ผ ์นด๋“œ ๋ชจ๋ฐ”์ผ UI ๊ตฌํ˜„ ๋ฐ ์ž„์‹œ ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ * ๐Ÿ’„ feat: ํ• ์ผ ์นด๋“œ ๋ฐ˜์‘ํ˜• ์ฒ˜๋ฆฌ ์ž‘์—… * Ux/94/sidebar (#100) * ๐Ÿ“ฆ chore : ์‚ฌ์ด๋“œ๋ฐ”์šฉ ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ (svg) * ๐Ÿ’„ style : ์‚ฌ์ด๋“œ๋ฐ” ๋ชจ๋ฐ”์ผ ์‚ฌ์šฉ์„ฑ ๊ฐœ์„  * โœจ feat: props๋ฐ›์„ ์ˆ˜ ์žˆ๊ฒŒ TodoCardProps ์ถ”๊ฐ€ ๋ฐ ์ž„์‹œ ์ฝ”๋“œ ์‚ญ์ œ * ๐Ÿ”ฅ fix: console.log ์ฝ”๋“œ ์‚ญ์ œ -------
1 parent dd5cf27 commit 198cfde

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

โ€Žpackage-lock.jsonโ€Ž

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

โ€Žsrc/app/(after-login)/dashboard/[id]/page.tsxโ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export default async function DashboardDetailPage({ params }: { params: Promise<
66

77
return (
88
<div className='p-10'>
9-
<div className='mb-8'>์•„์ด๋”” {id} : ๋Œ€์‹œ๋ณด๋“œ ์ƒ์„ธํŽ˜์ด์ง€</div>
109
<div>
1110
<Link href={`/dashboard/${id}/edit`}>
1211
<Button>์ˆ˜์ •ํ•˜๊ธฐ</Button>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Image from 'next/image';
2+
import { formatDate } from '@/utils/formatDate';
3+
import { Card } from '@/apis/cards/types';
4+
import Avatar from '../ui/Avatar/Avatar';
5+
import TagChip from '../ui/Chip/TagChip';
6+
import calendar from '@/assets/icons/calendar.svg';
7+
8+
interface TodoCardProps {
9+
card: Card;
10+
}
11+
12+
export default function TodoCard({ card }: TodoCardProps) {
13+
const formattedDate = formatDate(card.createdAt);
14+
15+
return (
16+
<div className='flex w-full flex-col gap-1 rounded-md border border-gray-30 bg-white px-3 py-[5px] md:flex-row md:gap-2.5 lg:w-[314px] lg:flex-col'>
17+
{card.imageUrl && <Image src={card.imageUrl} alt={card.description} className='w-full md:w-[90px] lg:w-full' width={90} height={20} />}
18+
<div className='flex flex-col gap-1.5 md:flex-1 md:flex-row lg:flex-col lg:gap-2'>
19+
<div className='flex flex-col gap-1.5 md:flex-none lg:gap-2.5'>
20+
<span className='text-md font-medium text-gray-70 lg:text-lg'>{card.title}</span>
21+
<div className='flex gap-1.5'>
22+
{card.tags.map((tag) => (
23+
<TagChip key={card.id} label={tag} />
24+
))}
25+
</div>
26+
</div>
27+
<div className='flex justify-between md:flex-auto md:items-end'>
28+
<div className='flex items-center gap-1'>
29+
<Image src={calendar} width={10} height={11} alt='์บ˜๋ฆฐ๋”' />
30+
<span className='text-xs font-medium text-gray-50'>{formattedDate}</span>
31+
</div>
32+
<Avatar email={card.assignee.nickname} size='sm' />
33+
</div>
34+
</div>
35+
</div>
36+
);
37+
}

โ€Žsrc/utils/formatDate.tsโ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import dayjs from 'dayjs';
2+
3+
const DATE_FORMAT = 'YYYY.MM.DD';
4+
5+
export const formatDate = (dateInput: string | number | Date): string => {
6+
return dayjs(dateInput).format(DATE_FORMAT);
7+
};

0 commit comments

Comments
ย (0)