Skip to content

Commit

Permalink
카드 내 설명을 최대, 최대 3줄로 고정하여 보여준다. (#7)
Browse files Browse the repository at this point in the history
* feat: 최대, 최소 라인 수 3인 카드 설명 구현

* refactor: Card를 사용하는 부분 CardDescription 적용
  • Loading branch information
alstn113 committed Jan 1, 2025
1 parent 5a1a81d commit 2e497c0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions web/src/components/common/CardDescription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

interface CardDescriptionProps {
children: React.ReactNode;
}

const CardDescription = ({ children }: CardDescriptionProps) => {
return <p className="text-default-500 line-clamp-3 text-sm h-[3.75rem]">{children}</p>;
};

export default CardDescription;
3 changes: 2 additions & 1 deletion web/src/components/dashboard/DraftExamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Image,
Link,
} from '@nextui-org/react';
import CardDescription from '../common/CardDescription';

interface ExamSummaryCardProps {
exam: ExamSummaryResponse;
Expand All @@ -35,7 +36,7 @@ const DraftExamCard = ({ exam }: ExamSummaryCardProps) => {
<Divider />
<CardBody>
<h3 className="text-lg font-semibold">{exam.title}</h3>
<p className="text-default-500 line-clamp-3">{exam.description}</p>
<CardDescription>{exam.description}</CardDescription>
</CardBody>
<Divider />
<CardFooter className="flex justify-between">
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/dashboard/SubmittedExamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SubmittedExamSummaryResponse } from '@/api/examAPI';
import { Routes } from '@/constants';
import { fromNowDate } from '@/lib/date.ts';
import { Card, CardBody, CardFooter, CardHeader, Divider, Image, Link } from '@nextui-org/react';
import CardDescription from '../common/CardDescription';

interface SubmittedExamCardProps {
submittedExam: SubmittedExamSummaryResponse;
Expand All @@ -28,7 +29,7 @@ const SubmittedExamCard = ({ submittedExam }: SubmittedExamCardProps) => {
<Divider />
<CardBody>
<h3 className="text-lg font-semibold">{submittedExam.title}</h3>
<p className="text-default-500 line-clamp-3">{submittedExam.description}</p>
<CardDescription>{submittedExam.description}</CardDescription>
</CardBody>
<Divider />
<CardFooter className="flex justify-between">
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/exams/ExamSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@nextui-org/react';
import toast from 'react-hot-toast';
import { useNavigate } from 'react-router';
import CardDescription from '../common/CardDescription';

interface ExamSummaryCardProps {
exam: ExamSummaryResponse;
Expand Down Expand Up @@ -54,7 +55,7 @@ const ExamSummaryCard = ({ exam }: ExamSummaryCardProps) => {
<Divider />
<CardBody>
<h3 className="text-lg font-semibold">{exam.title}</h3>
<p className="text-default-500 line-clamp-3">{exam.description}</p>
<CardDescription>{exam.description}</CardDescription>
</CardBody>
<Divider />
<CardFooter className="flex justify-between">
Expand Down

0 comments on commit 2e497c0

Please sign in to comment.