mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 03:56:19 +02:00
refactor: refactoring project structure and components, optimizing internationalization and page presentation
This commit is contained in:
parent
6674cb7072
commit
d6cff842e1
37 changed files with 156 additions and 146 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { themeConfig } from '@/config'
|
||||
import { getWalineLang } from '@/utils/ui'
|
||||
import { getWalineLang } from '@/utils/i18n/ui'
|
||||
|
||||
const {
|
||||
serverURL = '',
|
||||
|
@ -184,7 +184,7 @@ document.addEventListener('astro:after-swap', initWaline)
|
|||
--waline-bg-color-light: var(--lightBackground);
|
||||
--waline-bg-color-hover: var(--lightBackground);
|
||||
--waline-border-color: color-mix(in oklch, var(--lightPrimary), transparent 75%);
|
||||
--waline-disable-bg-color: color-mix(in oklch, var(--lightSecondary), transparent 85%);
|
||||
--waline-disable-bg-color: color-mix(in oklch, var(--lightSecondary), transparent 92%);
|
||||
--waline-disable-color: var(--lightPrimary);
|
||||
|
||||
/* Special Colors */
|
||||
|
@ -214,7 +214,7 @@ html.dark #waline {
|
|||
--waline-bg-color-light: var(--darkBackground);
|
||||
--waline-bg-color-hover: var(--darkBackground);
|
||||
--waline-border-color: color-mix(in oklch, var(--darkPrimary), transparent 75%);
|
||||
--waline-disable-bg-color: color-mix(in oklch, var(--darkSecondary), transparent 85%);
|
||||
--waline-disable-bg-color: color-mix(in oklch, var(--darkSecondary), transparent 92%);
|
||||
--waline-disable-color: var(--darkPrimary);
|
||||
|
||||
/* Special Colors */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import themeConfig from '@/config'
|
||||
import { getPagePath } from '@/utils/path'
|
||||
import { getPagePath } from '@/utils/i18n/path'
|
||||
|
||||
const { title, subtitle } = themeConfig.site
|
||||
const { titleSpace } = themeConfig.global
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import themeConfig from '@/config'
|
||||
import { getPagePath } from '@/utils/path'
|
||||
import { getPagePath } from '@/utils/i18n/path'
|
||||
|
||||
const { title, subtitle } = themeConfig.site
|
||||
const { titleSpace } = themeConfig.global
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { getPagePath } from '@/utils/path'
|
||||
import { ui } from '@/utils/ui'
|
||||
import { getPagePath } from '@/utils/i18n/path'
|
||||
import { ui } from '@/utils/i18n/ui'
|
||||
|
||||
const currentPath = Astro.url.pathname
|
||||
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath }
|
||||
|
|
61
src/components/PostTitleList.astro
Normal file
61
src/components/PostTitleList.astro
Normal file
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
// Define props received by the component
|
||||
interface Post {
|
||||
data: {
|
||||
title: string;
|
||||
slug?: string;
|
||||
published: Date;
|
||||
};
|
||||
slug?: string;
|
||||
remarkPluginFrontmatter?: {
|
||||
minutes?: number;
|
||||
};
|
||||
}
|
||||
|
||||
// Receive posts parameter passed from outside
|
||||
const { posts } = Astro.props;
|
||||
|
||||
// Declare the type of props
|
||||
export interface Props {
|
||||
posts: Post[];
|
||||
}
|
||||
---
|
||||
<ul>
|
||||
{posts.map(post => (
|
||||
// Single Post
|
||||
<li class="mt-4.375">
|
||||
|
||||
<a
|
||||
class="hover:c-primary"
|
||||
href={`/posts/${post.data.slug || post.slug}`}
|
||||
transition:name={`post-${post.data.slug || post.slug}`}
|
||||
data-disable-transition-on-theme
|
||||
>
|
||||
{post.data.title}
|
||||
</a>
|
||||
|
||||
<div
|
||||
class="uno-mobile-time"
|
||||
transition:name={`time-${post.data.slug || post.slug}`}
|
||||
data-disable-transition-on-theme
|
||||
>
|
||||
<time>
|
||||
{post.data.published.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-')}
|
||||
</time>
|
||||
<span class="ml-1.25">
|
||||
{post.remarkPluginFrontmatter?.minutes} min
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="uno-desktop-time">
|
||||
<time>
|
||||
{post.data.published.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-')}
|
||||
</time>
|
||||
<span class="ml-1.25">
|
||||
{post.remarkPluginFrontmatter?.minutes} min
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
Loading…
Add table
Add a link
Reference in a new issue