Skip to content

Commit

Permalink
Style featured items carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew7li committed Aug 2, 2023
1 parent bc877f3 commit 3c74836
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 58 deletions.
72 changes: 18 additions & 54 deletions src/components/carousel/CarouselItem.tsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,34 @@
import type { Content } from "@prisma/client";
import Link from "next/link";

import {
Button,
Card,
CardActions,
CardContent,
CardMedia,
Typography,
} from "@mui/material";

interface ICarouselItemProps {
content: Content;
onClick: () => void;
}

export default function CarouselItem({ content, onClick }: ICarouselItemProps) {
return (
<Card
sx={{ width: 300, height: 400, marginTop: "3rem" }}
<div
onClick={onClick}
style={{
cursor: "pointer",
}}
className="h-full w-[200px] cursor-pointer sm:w-[300px] md:w-[400px] lg:w-[500px]"
>
<CardMedia
sx={{ height: 250 }}
image={content.imgURL}
title={content.title}
/>
<CardContent>
<Typography
variant="h5"
component="div"
gutterBottom
className="-webkit-box overflow-hidden text-ellipsis"
style={{
display: "-webkit-box",
WebkitLineClamp: 1,
WebkitBoxOrient: "vertical",
}}
>
{content.title}
</Typography>
<Typography
variant="body2"
color="text.secondary"
className="-webkit-box overflow-hidden text-ellipsis"
style={{
display: "-webkit-box",
WebkitLineClamp: 2,
WebkitBoxOrient: "vertical",
}}
>
{content.caption}
</Typography>
</CardContent>
<CardActions
<img
src={content.imgURL}
alt={content.title}
onClick={onClick}
className="h-[85%] w-full"
style={{
padding: "0 0 0.5rem",
objectFit: "cover",
}}
>
<Link href={`/pieces/${content.id}`}>
<Button size="small">View</Button>
</Link>
</CardActions>
</Card>
/>
<Link href={`/pieces/${content.id}`}>
<p className="-webkit-box line-clamp-1 overflow-hidden text-ellipsis text-[2.5rem] font-medium text-white">
{content.title}
</p>
</Link>
<p className="-webkit-box line-clamp-2 overflow-hidden text-ellipsis text-[1rem] font-normal text-white">
{content.caption}
</p>
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/carousel/FeaturedCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function FeaturedCarousel({ data }: IFeaturedCarouselProps) {
};
});
return (
<div className="m-auto h-96 w-5/6">
<div className="m-auto flex h-[85%] w-[90vw] items-center">
<Carousel
// eslint-disable-next-line
// @ts-ignore
Expand Down
4 changes: 3 additions & 1 deletion src/components/sections/FeaturedContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default function FeaturedContent() {
}
return (
<>
<h1 className="text-center text-2xl font-bold lowercase">Featured</h1>
<p className="relative left-[3%] top-[-35%] hidden w-0 text-6xl font-normal lowercase text-white lg:block xl:left-[7%]">
Featured:
</p>
<FeaturedCarousel data={featuredContent} />
</>
);
Expand Down
7 changes: 5 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ const Home: NextPage = () => {
</div>
</section>

<section id="featured-content" className="mb-10">
<section
id="featured-content"
className="flex h-[80vh] items-center bg-zinc-800"
>
<FeaturedContent />
</section>

<section id="about">
<section id="about" className="mt-10">
<About />
</section>

Expand Down

0 comments on commit 3c74836

Please sign in to comment.