2026-04-23 20:52:43 +03:00
|
|
|
import { cn } from '$shared/lib';
|
2026-05-22 12:18:00 +03:00
|
|
|
import { Badge, Button, Card, CardSidebar, CardTitle, ImageLightbox, RichText } from '$shared/ui';
|
2026-04-19 08:37:21 +03:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
/**
|
|
|
|
|
* Project name
|
|
|
|
|
*/
|
2026-04-23 20:52:43 +03:00
|
|
|
title: string;
|
2026-04-19 08:37:21 +03:00
|
|
|
/**
|
|
|
|
|
* Year the project was completed
|
|
|
|
|
*/
|
2026-04-23 20:52:43 +03:00
|
|
|
year: string;
|
2026-04-19 08:37:21 +03:00
|
|
|
/**
|
|
|
|
|
* Short project description
|
|
|
|
|
*/
|
2026-04-23 20:52:43 +03:00
|
|
|
description: string;
|
2026-04-19 08:37:21 +03:00
|
|
|
/**
|
|
|
|
|
* Technology or category tags
|
|
|
|
|
*/
|
2026-04-23 20:52:43 +03:00
|
|
|
tags: string[];
|
2026-05-18 20:45:54 +03:00
|
|
|
/**
|
|
|
|
|
* Project's URL
|
|
|
|
|
*/
|
|
|
|
|
url: string;
|
2026-04-19 08:37:21 +03:00
|
|
|
/**
|
|
|
|
|
* Optional preview image URL
|
|
|
|
|
*/
|
2026-04-23 20:52:43 +03:00
|
|
|
imageUrl?: string;
|
2026-05-23 09:54:43 +03:00
|
|
|
/**
|
|
|
|
|
* Skip lazy-loading the preview image. Set true for above-the-fold cards
|
|
|
|
|
* (typically the first card in the list) to improve LCP.
|
|
|
|
|
* @default false
|
|
|
|
|
*/
|
|
|
|
|
priority?: boolean;
|
2026-04-23 20:52:43 +03:00
|
|
|
};
|
2026-04-19 08:37:21 +03:00
|
|
|
|
|
|
|
|
/**
|
2026-05-18 13:14:40 +03:00
|
|
|
* Project card with sidebar layout.
|
|
|
|
|
* Sidebar: year badge, stack tags, View Project button.
|
|
|
|
|
* Main: title, optional image, description.
|
2026-04-19 08:37:21 +03:00
|
|
|
*/
|
2026-05-23 09:54:43 +03:00
|
|
|
export function ProjectCard({ title, year, description, tags, url, imageUrl, priority = false }: Props) {
|
2026-04-19 08:37:21 +03:00
|
|
|
return (
|
2026-05-16 19:04:37 +03:00
|
|
|
<Card className={cn('group hover:shadow-brutal-xl transition-shadow duration-300')}>
|
2026-05-18 13:14:40 +03:00
|
|
|
<CardSidebar
|
|
|
|
|
sidebar={
|
|
|
|
|
<div className="flex flex-col gap-4">
|
2026-05-18 13:20:47 +03:00
|
|
|
<p className="text-sm font-medium brutal-border-left pl-3">{year}</p>
|
2026-05-18 13:14:40 +03:00
|
|
|
{tags.length > 0 && (
|
|
|
|
|
<div className="flex flex-wrap gap-2">
|
|
|
|
|
{tags.map((tag) => (
|
|
|
|
|
<Badge key={tag} variant="outline" size="xs">
|
|
|
|
|
{tag}
|
|
|
|
|
</Badge>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-05-23 09:54:43 +03:00
|
|
|
<Button href={url} variant="primary" size="sm" className="self-start lg:w-full lg:self-auto text-center">
|
2026-05-18 13:14:40 +03:00
|
|
|
View Project
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex flex-col gap-4">
|
|
|
|
|
<CardTitle className="font-heading">{title}</CardTitle>
|
2026-05-23 09:54:43 +03:00
|
|
|
{imageUrl && (
|
|
|
|
|
<ImageLightbox src={imageUrl} alt={title} priority={priority} className="brutal-border bg-blue" />
|
|
|
|
|
)}
|
2026-05-18 20:45:54 +03:00
|
|
|
<RichText html={description} />
|
2026-04-19 08:37:21 +03:00
|
|
|
</div>
|
2026-05-18 13:14:40 +03:00
|
|
|
</CardSidebar>
|
2026-04-19 08:37:21 +03:00
|
|
|
</Card>
|
2026-04-23 20:52:43 +03:00
|
|
|
);
|
2026-04-19 08:37:21 +03:00
|
|
|
}
|