@@ -184,7 +188,7 @@ const t = getTranslations(lang);
align-items: center;
justify-content: center;
text-decoration: none;
- border: #285ee9 1.5px solid;
+ border: #536493 1.5px solid;
background: rgba(255, 255, 255, 0.92);
color: #222;
/* box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); */
diff --git a/src/pages/[lang]/posts/[...slug].astro b/src/pages/[lang]/posts/[...slug].astro
index e09f631..4d00d90 100644
--- a/src/pages/[lang]/posts/[...slug].astro
+++ b/src/pages/[lang]/posts/[...slug].astro
@@ -22,7 +22,7 @@ export async function getStaticPaths() {
}
const { post, lang } = Astro.props;
-const { Content } = await render(post);
+const { Content, headings } = await render(post);
const [postLang, ...slugParts] = post.id.split("/");
const slug = slugParts.join("/");
@@ -34,6 +34,7 @@ const slug = slugParts.join("/");
lang={lang}
slug={slug}
postId={post.id}
+ headings={headings}
>
diff --git a/src/styles/global.css b/src/styles/global.css
index 3536dc8..5d6baf0 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -1,6 +1,8 @@
@import url("https://unpkg.com/@fontsource/maple-mono@5.2.6/400.css");
@import url("https://unpkg.com/@fontsource/maple-mono@5.2.6/400-italic.css");
@import url("https://unpkg.com/@fontsource/maple-mono@5.2.6/700.css");
+@import "./latest-comments.css";
+@import "./variables.css";
pre {
padding: 1rem;
@@ -43,8 +45,8 @@ html {
serif;
font-weight: 500;
/* background-color: #ffffff; */
- background-color: #F9F2ED;
- color: #0E2F56;
+ background-color: var(--background-color);
+ color: var(--text-color);
}
html {
@@ -158,268 +160,4 @@ img {
max-width: 100%;
height: auto;
display: block;
-}
-
-.latest-comments {
- margin-top: 1.5rem;
-}
-
-.latest-comments h2 {
- margin-bottom: 0.8rem;
-}
-
-.loading-card {
- height: 92px;
- margin: 0 0 14px 0;
- padding: 0.9rem 1rem;
- border: 1px dashed #aeb8c2;
- background: linear-gradient(90deg,
- rgba(160, 175, 190, 0.06) 25%,
- rgba(160, 175, 190, 0.16) 50%,
- rgba(160, 175, 190, 0.06) 75%);
- background-size: 200% 100%;
- animation: shimmer 1.2s infinite linear;
-}
-
-@keyframes shimmer {
- from {
- background-position: 200% 0;
- }
-
- to {
- background-position: -200% 0;
- }
-}
-
-.latest-comments-list {
- display: block;
-}
-
-.comment-card {
- display: block;
- margin: 0 0 14px 0;
- padding: 0.6rem 1rem;
- border: 2px dashed #aeb8c2;
- background-color: #fbf5f2;
-
-}
-
-.comment-card:last-child {
- margin-bottom: 0;
-}
-
-.comment-card-body {
- display: grid;
- grid-template-columns: minmax(0, 1fr) 320px;
- grid-template-areas:
- "info title"
- "text title";
- gap: 0.2rem 1rem;
- align-items: start;
-}
-
-.comment-card-info {
- grid-area: info;
- display: flex;
- align-items: center;
- gap: 0.7rem;
- min-width: 0;
-}
-
-.comment-avatar {
- width: 35px;
- height: 35px;
- flex-shrink: 0;
-}
-
-.comment-avatar-img,
-.comment-avatar-fallback {
- width: 35px;
- height: 35px;
- display: block;
- border-radius: 50%;
- object-fit: cover;
-}
-
-.comment-avatar-img {
- border: 1px dashed #aeb8c2;
- background: #f3f5f7;
-}
-
-.comment-avatar-fallback {
- display: flex;
- align-items: center;
- justify-content: center;
- border: 1px dashed #aeb8c2;
- background: rgba(160, 175, 190, 0.12);
- color: #5e6b77;
- font-weight: 700;
- font-size: 1rem;
- user-select: none;
-}
-
-.comment-meta {
- min-width: 0;
- flex: 1;
-}
-
-.comment-author-row {
- display: flex;
- flex-wrap: wrap;
- align-items: baseline;
- gap: 0.6rem;
- min-width: 0;
- line-height: 1.3;
- font-style: italic;
- font-family:
- system-ui,
- -apple-system,
- BlinkMacSystemFont,
- "Segoe UI",
- "PingFang SC",
- "Hiragino Sans GB",
- "Microsoft YaHei",
- "Noto Sans CJK SC",
- "Source Han Sans SC",
- sans-serif;
-}
-
-.comment-author {
- font-weight: 400;
- font-size: 0.8rem;
- color: gray;
- overflow-wrap: anywhere;
- word-break: break-word;
-}
-
-.comment-time {
- color: #7a7a7a;
- font-size: 0.7rem;
-}
-
-.comment-card-title {
- grid-area: title;
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- text-align: right;
- min-width: 0;
-}
-
-.comment-title-link {
- color: #6f8090;
- text-decoration: none;
- font-size: 1.1rem;
- font-weight: 700;
- line-height: 1.45;
- white-space: normal;
- overflow-wrap: anywhere;
- word-break: break-word;
-}
-
-.comment-title-link:hover {
- text-decoration: underline;
-}
-
-.comment-card-text {
- grid-area: text;
- margin: 0;
- color: #555;
- line-height: 1.5;
- font-size: 0.93rem;
- min-width: 0;
- overflow-wrap: anywhere;
- word-break: break-word;
- white-space: normal;
- font-family:
- system-ui,
- -apple-system,
- BlinkMacSystemFont,
- "Segoe UI",
- "PingFang SC",
- "Hiragino Sans GB",
- "Microsoft YaHei",
- "Noto Sans CJK SC",
- "Source Han Sans SC",
- sans-serif;
-}
-
-.comment-card-text :global(p),
-.comment-card-text p {
- margin: 0;
-}
-
-.comment-card-text :global(img),
-.comment-card-text img {
- max-width: 100%;
- height: auto;
-}
-
-.latest-comments-empty {
- color: #777;
- font-style: italic;
-}
-
-.comment-reply-sep {
- font-size: 0.8rem;
- opacity: 0.7;
-}
-
-.latest-comments .comment-reply-to {
- font-weight: 400;
- font-size: 0.8rem;
- color: gray;
- opacity: 0.9;
- overflow-wrap: anywhere;
- word-break: break-word;
-}
-
-html.dark .latest-comments .comment-card,
-.dark .latest-comments .comment-card {
- border-color: #7f8c97;
- background-color: #252525;
-}
-
-html.dark .comment-title-link {
- color: #c8d2dc;
-}
-
-html.dark .comment-card-text {
- color: #d3d7db;
-}
-
-html.dark .comment-time {
- color: #a8b0b7;
-}
-
-html.dark .latest-comments .comment-avatar-fallback,
-.dark .latest-comments .comment-avatar-fallback {
- border-color: #7f8c97;
- background-color: #3a444d;
- color: #dbe3ea;
-}
-
-:global(.dark) .comment-avatar-fallback {
- background: rgba(180, 190, 200, 0.12);
- color: #dbe3ea;
-}
-
-@media (max-width: 640px) {
- .comment-card-body {
- grid-template-columns: 1fr;
- grid-template-areas:
- "title"
- "info"
- "text";
- }
-
- .comment-card-title {
- text-align: left;
- margin-bottom: 0.2rem;
- }
-
- .comment-title-link {
- display: block;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
}
\ No newline at end of file
diff --git a/src/styles/latest-comments.css b/src/styles/latest-comments.css
new file mode 100644
index 0000000..7751854
--- /dev/null
+++ b/src/styles/latest-comments.css
@@ -0,0 +1,263 @@
+.latest-comments {
+ margin-top: 1.5rem;
+}
+
+.latest-comments h2 {
+ margin-bottom: 0.8rem;
+}
+
+.loading-card {
+ height: 92px;
+ margin: 0 0 14px 0;
+ padding: 0.9rem 1rem;
+ border: 1px dashed #aeb8c2;
+ background: linear-gradient(90deg,
+ rgba(160, 175, 190, 0.06) 25%,
+ rgba(160, 175, 190, 0.16) 50%,
+ rgba(160, 175, 190, 0.06) 75%);
+ background-size: 200% 100%;
+ animation: shimmer 1.2s infinite linear;
+}
+
+@keyframes shimmer {
+ from {
+ background-position: 200% 0;
+ }
+
+ to {
+ background-position: -200% 0;
+ }
+}
+
+.latest-comments-list {
+ display: block;
+}
+
+.comment-card {
+ display: block;
+ margin: 0 0 14px 0;
+ padding: 0.6rem 1rem;
+ border: 2px dashed #aeb8c2;
+ background-color: #fbf5f2;
+
+}
+
+.comment-card:last-child {
+ margin-bottom: 0;
+}
+
+.comment-card-body {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 320px;
+ grid-template-areas:
+ "info title"
+ "text title";
+ gap: 0.2rem 1rem;
+ align-items: start;
+}
+
+.comment-card-info {
+ grid-area: info;
+ display: flex;
+ align-items: center;
+ gap: 0.7rem;
+ min-width: 0;
+}
+
+.comment-avatar {
+ width: 35px;
+ height: 35px;
+ flex-shrink: 0;
+}
+
+.comment-avatar-img,
+.comment-avatar-fallback {
+ width: 35px;
+ height: 35px;
+ display: block;
+ border-radius: 50%;
+ object-fit: cover;
+}
+
+.comment-avatar-img {
+ border: 1px dashed #aeb8c2;
+ background: #f3f5f7;
+}
+
+.comment-avatar-fallback {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: 1px dashed #aeb8c2;
+ background: rgba(160, 175, 190, 0.12);
+ color: #5e6b77;
+ font-weight: 700;
+ font-size: 1rem;
+ user-select: none;
+}
+
+.comment-meta {
+ min-width: 0;
+ flex: 1;
+}
+
+.comment-author-row {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: 0.6rem;
+ min-width: 0;
+ line-height: 1.3;
+ font-style: italic;
+ font-family:
+ system-ui,
+ -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ "PingFang SC",
+ "Hiragino Sans GB",
+ "Microsoft YaHei",
+ "Noto Sans CJK SC",
+ "Source Han Sans SC",
+ sans-serif;
+}
+
+.comment-author {
+ font-weight: 400;
+ font-size: 0.8rem;
+ color: gray;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+}
+
+.comment-time {
+ color: #7a7a7a;
+ font-size: 0.7rem;
+}
+
+.comment-card-title {
+ grid-area: title;
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
+ text-align: right;
+ min-width: 0;
+}
+
+.comment-title-link {
+ color: #6f8090;
+ text-decoration: none;
+ font-size: 1.1rem;
+ font-weight: 700;
+ line-height: 1.45;
+ white-space: normal;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+}
+
+.comment-title-link:hover {
+ text-decoration: underline;
+}
+
+.comment-card-text {
+ grid-area: text;
+ margin: 0;
+ color: #555;
+ line-height: 1.5;
+ font-size: 0.93rem;
+ min-width: 0;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+ white-space: normal;
+ font-family:
+ system-ui,
+ -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ "PingFang SC",
+ "Hiragino Sans GB",
+ "Microsoft YaHei",
+ "Noto Sans CJK SC",
+ "Source Han Sans SC",
+ sans-serif;
+}
+
+.comment-card-text :global(p),
+.comment-card-text p {
+ margin: 0;
+}
+
+.comment-card-text :global(img),
+.comment-card-text img {
+ max-width: 100%;
+ height: auto;
+}
+
+.latest-comments-empty {
+ color: #777;
+ font-style: italic;
+}
+
+.comment-reply-sep {
+ font-size: 0.8rem;
+ opacity: 0.7;
+}
+
+.latest-comments .comment-reply-to {
+ font-weight: 400;
+ font-size: 0.8rem;
+ color: gray;
+ opacity: 0.9;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+}
+
+html.dark .latest-comments .comment-card,
+.dark .latest-comments .comment-card {
+ border-color: #7f8c97;
+ background-color: #252525;
+}
+
+html.dark .comment-title-link {
+ color: #c8d2dc;
+}
+
+html.dark .comment-card-text {
+ color: #d3d7db;
+}
+
+html.dark .comment-time {
+ color: #a8b0b7;
+}
+
+html.dark .latest-comments .comment-avatar-fallback,
+.dark .latest-comments .comment-avatar-fallback {
+ border-color: #7f8c97;
+ background-color: #3a444d;
+ color: #dbe3ea;
+}
+
+:global(.dark) .comment-avatar-fallback {
+ background: rgba(180, 190, 200, 0.12);
+ color: #dbe3ea;
+}
+
+@media (max-width: 640px) {
+ .comment-card-body {
+ grid-template-columns: 1fr;
+ grid-template-areas:
+ "title"
+ "info"
+ "text";
+ }
+
+ .comment-card-title {
+ text-align: left;
+ margin-bottom: 0.2rem;
+ }
+
+ .comment-title-link {
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+}
\ No newline at end of file
diff --git a/src/styles/variables.css b/src/styles/variables.css
new file mode 100644
index 0000000..8b14afc
--- /dev/null
+++ b/src/styles/variables.css
@@ -0,0 +1,9 @@
+:root {
+ --deep-blue: #536493;
+ --deep-red: #ef5a6f;
+ --background-color: #f9f2ed;
+ --text-color: #0E2F56;
+
+ --background-color-dark: #1e1e1e;
+ --text-color-dark: #e6e6e6;
+}
\ No newline at end of file