import { useState } from "preact/hooks"; import { Portal } from "./Portal.tsx"; import { type ModalAction, ProjectModal } from "./ProjectModal.tsx"; import { ImageCarousel } from "./ImageCarousel.tsx"; import * as hi from "@preact-icons/hi2"; export const ProjectCard = function ProjectCard(props: ProjectProps) { const [open, setOpen] = useState(false); const modalButtons: Array = [ { label: "Open repository", icon: , onClick: () => { if (props.repo) globalThis.open(props.repo, "_blank"); }, variant: "primary", }, ]; return (
{ // clicking the card (not the link) opens the modal setOpen(true); }} >

{ // clicking the link should not open the modal e.stopPropagation(); }} > {props.title}

{props.repo && Active} {!props.repo && !props.wip && Dead} {props.wip && WIP}

{props.summary}

{props.tech}

{open && !props.wip ? ( setOpen(false)} actions={modalButtons} >
{props.images && props.images.length > 0 && ( )}

{props.description}

Technologies used: {props.tech}

) : null}
); }; type ProjectProps = { title: string; repo?: string; summary: string; description?: string; tech: string; wip?: boolean; images?: string[]; };