refactor: enhance site navigation and styling

- Add view transitions for site title
- Update Navbar with hover effects and improved typography
- Modify index page layout with decorative lines and date formatting
- Adjust post publication dates
- Update VSCode dictionary with new terms
This commit is contained in:
radishzzz 2025-02-04 22:32:15 +00:00
parent 95f15c2016
commit bdc2aa32e6
9 changed files with 34 additions and 21 deletions

View file

@ -63,6 +63,7 @@
"astrojs", "astrojs",
"attributify", "attributify",
"bmoji", "bmoji",
"Frontmatter",
"gtag", "gtag",
"katex", "katex",
"Lightbox", "Lightbox",
@ -76,6 +77,9 @@
"radishzz", "radishzz",
"rehype", "rehype",
"Retypeset", "Retypeset",
"Roundhand",
"STIX",
"titlebar",
"Umami", "Umami",
"unocss", "unocss",
"vite", "vite",

View file

@ -16,7 +16,10 @@ const marginBottom = {
<header> <header>
<h1 class={`${marginBottom} mt--5 text-12.8 c-primary font-bold font-title`}> <h1 class={`${marginBottom} mt--5 text-12.8 c-primary font-bold font-title`}>
<a href={getLocalizedPath('/')}> <a
href={getLocalizedPath('/')}
transition:name="site-title"
>
{title} {title}
</a> </a>
</h1> </h1>

View file

@ -3,21 +3,24 @@ import { getPagePath } from '@/utils/path'
import { ui } from '@/utils/ui' import { ui } from '@/utils/ui'
const currentPath = Astro.url.pathname const currentPath = Astro.url.pathname
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath } = getPagePath(currentPath) const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath }
= getPagePath(currentPath)
const currentUI = ui[currentLang as keyof typeof ui] const currentUI = ui[currentLang as keyof typeof ui]
const isPostActive = isHome || isPost const isPostActive = isHome || isPost
const isTagActive = isTag const isTagActive = isTag
const isAboutActive = isAbout const isAboutActive = isAbout;
--- ---
<nav class="mb-16 mt-13 text-5.6 font-semibold leading-13 font-navbar"> <nav class="mb-17 mt-17 text-5.84 font-semibold leading-14 font-navbar">
<ul> <ul>
<li> <li>
<a <a
href={getLocalizedPath('/')} href={getLocalizedPath('/')}
class:list={[ class:list={[
isPostActive ? 'font-bold text-primary' : '', isPostActive
? 'font-bold text-primary'
: 'hover:text-primary hover:font-bold',
]} ]}
> >
{currentUI.posts} {currentUI.posts}
@ -27,7 +30,9 @@ const isAboutActive = isAbout
<a <a
href={getLocalizedPath('/tags')} href={getLocalizedPath('/tags')}
class:list={[ class:list={[
isTagActive ? 'font-bold text-primary' : '', isTagActive
? 'font-bold text-primary'
: 'hover:text-primary hover:font-bold',
]} ]}
> >
{currentUI.tags} {currentUI.tags}
@ -37,7 +42,9 @@ const isAboutActive = isAbout
<a <a
href={getLocalizedPath('/about')} href={getLocalizedPath('/about')}
class:list={[ class:list={[
isAboutActive ? 'font-bold text-primary' : '', isAboutActive
? 'font-bold text-primary'
: 'hover:text-primary hover:font-bold',
]} ]}
> >
{currentUI.about} {currentUI.about}

View file

@ -10,6 +10,7 @@ const { getLocalizedPath } = getPagePath(currentPath)
<a <a
class="mt--1.4 text-8.32 c-secondary font-bold font-title" class="mt--1.4 text-8.32 c-secondary font-bold font-title"
href={getLocalizedPath('/')} href={getLocalizedPath('/')}
transition:name="site-title"
> >
{title} {title}
</a> </a>

View file

@ -2,8 +2,6 @@
title: Retypeset 主题介绍 title: Retypeset 主题介绍
published: 2024-01-25 published: 2024-01-25
tags: ["Astro", "博客主题"] tags: ["Astro", "博客主题"]
lang: zh
slug: theme-introduction
--- ---
Retypeset 是一款基于 Astro 的博客主题,中文名为『重新编排』,最初灵感来源于 Typography。本主题在保留原『活字印刷』风格的基础上以版式设计为核心对所有页面都进行了重新编排营造出简约现代的视觉风格同时又流淌着传统印刷的人文气韵。 Retypeset 是一款基于 Astro 的博客主题,中文名为『重新编排』,最初灵感来源于 Typography。本主题在保留原『活字印刷』风格的基础上以版式设计为核心对所有页面都进行了重新编排营造出简约现代的视觉风格同时又流淌着传统印刷的人文气韵。

View file

@ -1,6 +1,6 @@
--- ---
title: 容忍与自由 title: 容忍与自由
published: 2024-03-16 published: 2022-06-17
tags: ["胡适"] tags: ["胡适"]
--- ---

View file

@ -1,6 +1,6 @@
--- ---
title: 羅生門 title: 羅生門
published: 2024-03-05 published: 2022-03-05
tags: ["芥川龙之介"] tags: ["芥川龙之介"]
--- ---

View file

@ -26,21 +26,21 @@ const postsByYear = await getPostsByYear()
</section> </section>
)} )}
{[...postsByYear.entries()].map(([year, posts]) => ( {[...postsByYear.entries()].map(([_year, posts]) => (
// Year Group // Year Group
<section class="mt-8"> <section class="mt-12">
{/* Year */} {/* Decorative Line */}
<time class="text-8 font-navbar">{year}</time> <div class="h-0.2 w-16 bg-secondary opacity-25"></div>
{/* Posts List */} {/* Posts List */}
<ul> <ul>
{posts.map(post => ( {posts.map(post => (
// Single Post // Single Post
<li class="mt-6"> <li class="mt-7">
{/* Post Title */} {/* Post Title */}
<a class="hover:text-secondary" href={`/posts/${post.data.slug || post.slug}`}>{post.data.title}</a> <a class="hover:text-primary" href={`/posts/${post.data.slug || post.slug}`}>{post.data.title}</a>
{/* Post Date */} {/* Post Date */}
<div class="block text-5.6 leading-7 font-navbar lg:inline lg:before:content-['_']" aria-hidden="true"> <div class="mb-9 block text-5.6 leading-11 font-time lg:ml-4 lg:inline">
{post.data.published.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit' }).replace('/', '-')} {post.data.published.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-')}
{post.remarkPluginFrontmatter?.minutes && <span class="ml-2"> {post.remarkPluginFrontmatter.minutes} min</span>} {post.remarkPluginFrontmatter?.minutes && <span class="ml-2"> {post.remarkPluginFrontmatter.minutes} min</span>}
</div> </div>
</li> </li>