import { useState } from "preact/hooks"; import { Portal } from "./Portal.tsx"; import { type ModalAction, ProjectModal } from "./ProjectModal.tsx"; export const ProjectCard = function ProjectCard(props: ProjectProps) { const [open, setOpen] = useState(false); const modalButtons: Array = [ { label: "Open repository", onClick: () => { if (props.repo) globalThis.open(props.repo, "_blank"); }, variant: "primary", }, ]; return (
{ // clicking the card (not the link) opens the modal console.log("opened portal"); 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.description}

Technologies used: {props.tech}

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