import { useState } from "preact/hooks";
import { Portal } from "./portal.tsx";
import { Modal } from "./modal.tsx";
export const ProjectCard = function ProjectCard(props: ProjectProps) {
const [open, setOpen] = useState(false);
return (
{
// clicking the card (not the link) opens the modal
console.log("opened portal");
setOpen(true);
}}
>
{props.repo && Active}
{!props.repo && !props.wip && Dead}
{props.wip && WIP}
{props.summary}
{props.tech}
{open && !props.wip ? (
setOpen(false)}
actions={[
{
label: "Open repository",
onClick: () => {
if (props.repo) window.open(props.repo, "_blank");
},
variant: "primary",
},
{
label: "Close",
onClick: () => setOpen(false),
variant: "secondary",
},
]}
>
{props.summary}
Technologies used: {props.tech}
) : null}
);
};
type ProjectProps = {
title: string;
repo?: string;
summary: string;
tech: string;
wip?: boolean;
};