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

VerticalCard 버그 픽스 #127

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from all 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
1 change: 1 addition & 0 deletions src/app/insight/page.tsx
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ const Page = () => {
onClick={() => handleInsightClick(insight)}
>
<NewsCardVertical
isMock
date={insight.date}
description={insight.content}
id={insight.id}
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';
@@ -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>
);
};