Skip to content

Commit

Permalink
VerticalCard 버그 픽스 (#127)
Browse files Browse the repository at this point in the history
* feat: VerticalCard 버그 픽스
#126

* feat: 의존성 정리
#126
  • Loading branch information
stopmin authored Jul 23, 2024
1 parent 5d8bbe1 commit 49dee2a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/app/insight/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const Page = () => {
onClick={() => handleInsightClick(insight)}
>
<NewsCardVertical
isMock
date={insight.date}
description={insight.content}
id={insight.id}
Expand Down
96 changes: 47 additions & 49 deletions src/components/NewsCardVertical.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Image from 'next/image';

import { Card, CardContent, CardMedia, Link, Typography } from '@mui/material';

import color from '@/constants/color';
Expand All @@ -11,60 +9,60 @@ interface NewsCardVerticalProps {
description: string;
imageUrl?: string;
path?: string;
isMock?: boolean;
}

const NewsCardVertical = ({ id, date, title, description, imageUrl, path }: NewsCardVerticalProps) => {
const NewsCardVertical = ({ id, date, title, description, imageUrl, path, isMock = false }: NewsCardVerticalProps) => {
const cardContent = (
<>
<Typography color={color.blue} fontWeight="600" mb={1} variant="body2">
{date}
</Typography>
<Typography
mb={1}
sx={{
overflow: 'hidden',
WebkitLineClamp: 2,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
variant="h5"
>
{title}
</Typography>
<Typography
sx={{
overflow: 'hidden',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
variant="body2"
>
{description}
</Typography>
</>
);

return (
<Card sx={{ maxWidth: 350, boxShadow: 'none', borderRadius: 4 }}>
<Link color="inherit" href={`/${path}/${id}`} underline="none">
{imageUrl && (
{imageUrl &&
(isMock ? (
<CardMedia alt="articleImage" component="img" image={imageUrl} sx={{ height: 190, borderRadius: 2 }} />
)}
</Link>
) : (
<Link color="inherit" href={`/${path}/${id}`} underline="none">
<CardMedia alt="articleImage" component="img" image={imageUrl} sx={{ height: 190, borderRadius: 2 }} />
</Link>
))}
<CardContent>
<Link color="inherit" href={`/${path}/${id}`} underline="none">
<Typography color={color.blue} fontWeight="600" mb={1} variant="body2">
{date}
</Typography>
<Typography
mb={1}
sx={{
overflow: 'hidden',
WebkitLineClamp: 2,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
variant="h5"
>
{title}
</Typography>
<Typography
sx={{
overflow: 'hidden',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
variant="body2"
>
{description}
</Typography>
</Link>
{isMock ? (
cardContent
) : (
<Link color="inherit" href={`/${path}/${id}`} underline="none">
{cardContent}
</Link>
)}
</CardContent>
{imageUrl && (
<Link
borderRadius={2}
height={130}
href={`/${path}/${id}`}
minWidth={230}
ml={3}
mt={2}
overflow="hidden"
position="relative"
>
<Image fill priority alt="articleImage" sizes="100%" src={imageUrl} style={{ objectFit: 'cover' }} />
</Link>
)}
</Card>
);
};
Expand Down

0 comments on commit 49dee2a

Please sign in to comment.