added project modal, portal, and backend code to get description
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
import { useState } from "preact/hooks";
|
||||
import { Portal } from "./portal.tsx";
|
||||
import { Modal } from "./modal.tsx";
|
||||
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<ModalAction> = [
|
||||
{
|
||||
label: "Open repository",
|
||||
onClick: () => {
|
||||
if (props.repo) globalThis.open(props.repo, "_blank");
|
||||
},
|
||||
variant: "primary",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div
|
||||
class={`md:m-8 group space-y-1 rounded-md ${
|
||||
@@ -53,33 +63,20 @@ export const ProjectCard = function ProjectCard(props: ProjectProps) {
|
||||
|
||||
{open && !props.wip ? (
|
||||
<Portal into="body">
|
||||
<Modal
|
||||
<ProjectModal
|
||||
title={props.title}
|
||||
onClose={() => setOpen(false)}
|
||||
actions={[
|
||||
{
|
||||
label: "Open repository",
|
||||
onClick: () => {
|
||||
if (props.repo) window.open(props.repo, "_blank");
|
||||
},
|
||||
variant: "primary",
|
||||
},
|
||||
{
|
||||
label: "Close",
|
||||
onClick: () => setOpen(false),
|
||||
variant: "secondary",
|
||||
},
|
||||
]}
|
||||
actions={modalButtons}
|
||||
>
|
||||
<div class="space-y-3">
|
||||
<p class="text-sm text-gray-800 dark:text-gray-200">
|
||||
{props.summary}
|
||||
{props.description}
|
||||
</p>
|
||||
<p class="text-xs font-mono text-gray-600 dark:text-gray-300">
|
||||
Technologies used: {props.tech}
|
||||
</p>
|
||||
</div>
|
||||
</Modal>
|
||||
</ProjectModal>
|
||||
</Portal>
|
||||
) : null}
|
||||
</div>
|
||||
@@ -90,6 +87,7 @@ type ProjectProps = {
|
||||
title: string;
|
||||
repo?: string;
|
||||
summary: string;
|
||||
description?: string;
|
||||
tech: string;
|
||||
wip?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user