diff options
Diffstat (limited to 'old_stuff/src/components/BlogItem.astro')
| -rw-r--r-- | old_stuff/src/components/BlogItem.astro | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/old_stuff/src/components/BlogItem.astro b/old_stuff/src/components/BlogItem.astro new file mode 100644 index 0000000..8440d85 --- /dev/null +++ b/old_stuff/src/components/BlogItem.astro @@ -0,0 +1,40 @@ +--- +import TerminalBorder from "@components/TerminalBorder.astro"; + +function formatDate(date: Date) { + const day = date.getDate(); + const month = date.toLocaleString("default", { month: "long" }); + const year = date.getFullYear(); + return `${month} ${day}, ${year}`; +} + +interface Props { + title: string; + description: string; + date: Date; + href?: string; + header?: string; +} + +const { title, description, date, href, header } = Astro.props; +--- + +<TerminalBorder header={header} footer={formatDate(date)} extra="mr-[0.1vw] sm:mr-0 mb-[5vw] sm:mb-[2vw]"> + <span class="cursor-pointer group block w-full"> + { + href ? ( + <a href={href} style="all: unset;"> + <h1 class="text-[130%] text-[var(--accent)] group-hover:underline"> + {title} + </h1> + <p class="text-[var(--secondary)]">{description}</p> + </a> + ) : ( + <> + <h1 class="text-[130%] text-[var(--accent)]">{title}</h1> + <p class="text-[var(--secondary)]">{description}</p> + </> + ) + } + </span> +</TerminalBorder> |
