refactor: ProjectCard sidebar layout — year, tags, button in sidebar
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Image from 'next/image';
|
||||
import { cn } from '$shared/lib';
|
||||
import { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '$shared/ui';
|
||||
import { Badge, Button, Card, CardSidebar, CardTitle } from '$shared/ui';
|
||||
|
||||
type Props = {
|
||||
/**
|
||||
@@ -26,38 +26,42 @@ type Props = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Compact project card for grid/list display.
|
||||
* Project card with sidebar layout.
|
||||
* Sidebar: year badge, stack tags, View Project button.
|
||||
* Main: title, optional image, description.
|
||||
*/
|
||||
export function ProjectCard({ title, year, description, tags, imageUrl }: Props) {
|
||||
return (
|
||||
<Card className={cn('group hover:shadow-brutal-xl transition-shadow duration-300')}>
|
||||
<CardHeader>
|
||||
<div className="flex flex-row justify-between items-start mb-3">
|
||||
<CardTitle className="flex-1 font-heading">{title}</CardTitle>
|
||||
<span className="brutal-border px-3 py-1 bg-blue text-cream text-sm">{year}</span>
|
||||
<CardSidebar
|
||||
sidebar={
|
||||
<div className="flex flex-col gap-4">
|
||||
<Badge>{year}</Badge>
|
||||
{tags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{tags.map((tag) => (
|
||||
<Badge key={tag} variant="outline" size="xs">
|
||||
{tag}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<Button variant="primary" className="w-full">
|
||||
View Project
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
<CardTitle className="font-heading">{title}</CardTitle>
|
||||
{imageUrl && (
|
||||
<div className="brutal-border aspect-video bg-blue overflow-hidden relative">
|
||||
<Image src={imageUrl} alt={title} fill className="object-cover" />
|
||||
</div>
|
||||
)}
|
||||
<p className="opacity-80">{description}</p>
|
||||
</div>
|
||||
<CardDescription>{description}</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
{imageUrl && (
|
||||
<div className="brutal-border my-6 aspect-video bg-blue overflow-hidden relative">
|
||||
<Image src={imageUrl} alt={title} fill className="object-cover" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<CardContent className="flex flex-wrap gap-2">
|
||||
{tags.map((tag) => (
|
||||
<span key={tag} className="brutal-border px-3 py-1 bg-cream text-blue text-sm uppercase tracking-wide">
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</CardContent>
|
||||
|
||||
<CardFooter>
|
||||
<Button variant="primary" className="w-full">
|
||||
View Project
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</CardSidebar>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user