+
-
Posted on:
+ {modDatetime && modDatetime > pubDatetime ? (
+
+ Updated:
+
+ ) : (
+
Published:
+ )}
-
+
+ {size === "lg" && }
);
}
-const FormattedDatetime = ({ datetime }: { datetime: string | Date }) => {
- const myDatetime = new Date(datetime);
+const FormattedDatetime = ({ pubDatetime, modDatetime }: DatetimesProps) => {
+ const myDatetime = new Date(
+ modDatetime && modDatetime > pubDatetime ? modDatetime : pubDatetime
+ );
- const date = myDatetime.toLocaleDateString(LOCALE, {
+ const date = myDatetime.toLocaleDateString(LOCALE.langTag, {
year: "numeric",
- month: "long",
+ month: "short",
day: "numeric",
});
- const time = myDatetime.toLocaleTimeString(LOCALE, {
+ const time = myDatetime.toLocaleTimeString(LOCALE.langTag, {
hour: "2-digit",
minute: "2-digit",
});
return (
<>
- {date}
+
|
at
- {time}
+
{time}
>
);
};
+
+const EditPost = ({ editPost, postId }: EditPostProps) => {
+ let editPostUrl = editPost?.url ?? SITE?.editPost?.url ?? "";
+ const showEditPost = !editPost?.disabled && editPostUrl.length > 0;
+ const appendFilePath =
+ editPost?.appendFilePath ?? SITE?.editPost?.appendFilePath ?? false;
+ if (appendFilePath && postId) {
+ editPostUrl += `/${postId}`;
+ }
+ const editPostText = editPost?.text ?? SITE?.editPost?.text ?? "Edit";
+
+ return (
+ showEditPost && (
+ <>
+
|
+
+
+ {editPostText}
+
+ >
+ )
+ );
+};
diff --git a/src/components/Footer.astro b/src/components/Footer.astro
index ed48d15..801bdc1 100644
--- a/src/components/Footer.astro
+++ b/src/components/Footer.astro
@@ -16,7 +16,9 @@ const { noMarginTop = false } = Astro.props;
diff --git a/src/components/Header.astro b/src/components/Header.astro
index 77e0c41..e0b1144 100644
--- a/src/components/Header.astro
+++ b/src/components/Header.astro
@@ -4,7 +4,7 @@ import Hr from "./Hr.astro";
import LinkButton from "./LinkButton.astro";
export interface Props {
- activeNav?: "posts" | "tags" | "about" | "search";
+ activeNav?: "posts" | "archives" | "tags" | "about" | "search";
}
const { activeNav } = Astro.props;
@@ -56,23 +56,58 @@ const { activeNav } = Astro.props;
@@ -154,7 +190,7 @@ const { activeNav } = Astro.props;
nav ul li:nth-last-child(2) {
@apply col-span-1;
}
- nav a.active {
+ nav .active {
@apply underline decoration-wavy decoration-2 underline-offset-4;
}
nav a.active svg {
diff --git a/src/components/LinkButton.astro b/src/components/LinkButton.astro
index c37608a..69cf114 100644
--- a/src/components/LinkButton.astro
+++ b/src/components/LinkButton.astro
@@ -7,22 +7,32 @@ export interface Props {
disabled?: boolean;
}
-const { href, className, ariaLabel, title, disabled = false } = Astro.props;
+const {
+ href,
+ className = "",
+ ariaLabel,
+ title,
+ disabled = false,
+} = Astro.props;
---
-