update: desktop style

This commit is contained in:
radishzzz 2025-03-18 04:03:42 +00:00
parent 0dcd3a5838
commit b4bd409e4b
7 changed files with 39 additions and 18 deletions

View file

@ -63,7 +63,10 @@ function formatDate(date: Date, format: 'YYYY-MM-DD' | 'MM-DD-YYYY' | 'DD-MM-YYY
<!-- updated date -->
{updatedDate && (
<time datetime={updatedDate.toISOString().split('T')[0]} class={timeSpacingClass}>
<time
datetime={updatedDate.toISOString().split('T')[0]}
class={timeSpacingClass}
>
updated {formatDate(updatedDate, format)}
</time>
)}

View file

@ -3,6 +3,7 @@ import type { CollectionEntry } from 'astro:content'
import PostDate from '@/components/PostDate.astro'
import { defaultLocale } from '@/config'
import { generateDescription } from '@/utils/description'
import { isTagPage } from '@/utils/page'
type Post = CollectionEntry<'posts'> & {
remarkPluginFrontmatter?: {
@ -11,6 +12,7 @@ type Post = CollectionEntry<'posts'> & {
}
const { posts, lang } = Astro.props
const isTag = isTagPage(Astro.url.pathname)
export interface Props {
posts: Post[]
@ -26,12 +28,15 @@ function getPostPath(post: Post) {
---
<ul>
{posts.map(post => (
<li class="mb-5.5 lg:mb-7.5">
<li
class="mb-5.5"
lg={isTag ? '' : 'mb-10'}
>
{/* post title */}
<a
class="hover:c-primary"
lg="font-medium text-4.5"
lg={isTag ? '' : 'font-medium text-4.5'}
href={getPostPath(post)}
transition:name={`post-${post.data.abbrlink || post.slug}-${lang}`}
data-disable-transition-on-theme
@ -64,12 +69,14 @@ function getPostPath(post: Post) {
</div>
{/* desktop post description */}
<div
class="heti hidden"
lg="mt-2 block"
>
<p>{generateDescription(post, 'list')}</p>
</div>
{!isTag && (
<div
class="heti hidden"
lg="mt-2 block"
>
<p>{generateDescription(post, 'list')}</p>
</div>
)}
</li>
))}

View file

@ -59,7 +59,10 @@ const mobileFooterMargin = isPost && themeConfig.comment?.waline?.serverURL
<MainHeader />
<Navigation />
<!-- Desktop footer -->
<Footer class="fixed hidden lg:block" supportedLangs={supportedLangs} />
<Footer
class="fixed hidden lg:block"
supportedLangs={supportedLangs}
/>
</div>
<!-- show simple header on mobile for post pages -->
@ -71,7 +74,10 @@ const mobileFooterMargin = isPost && themeConfig.comment?.waline?.serverURL
</main>
<!-- Mobile footer -->
<Footer class={`block lg:hidden ${mobileFooterMargin}`} supportedLangs={supportedLangs} />
<Footer
class={`block lg:hidden ${mobileFooterMargin}`}
supportedLangs={supportedLangs}
/>
</div>
<!-- <Scrollbar /> -->
@ -79,7 +85,10 @@ const mobileFooterMargin = isPost && themeConfig.comment?.waline?.serverURL
<!-- <PhotoSwipe /> -->
<!-- Mobile widget (fix position issue on ios / fix right distance)-->
<div class="absolute right-7.25vw top-13.6 flex gap-6 [@supports(-webkit-touch-callout:none)]:top-12.6 min-[823px]:right-[calc(50vw-22rem)] lg:hidden">
<div
class="absolute right-7.25vw top-13.6 flex gap-6 [@supports(-webkit-touch-callout:none)]:top-12.6 min-[823px]:right-[calc(50vw-22rem)]"
lg="hidden"
>
<LanguageSwitcher supportedLangs={supportedLangs} />
<ThemeToggle />
</div>

View file

@ -39,7 +39,7 @@ const postsByYear = await getPostsByYear(lang)
<!-- Pinned Posts -->
{pinnedPosts.length > 0 && (
<section class="mb-7.5 lg:mb-9.5">
<section class="mb-7.5 lg:mb-10">
<div class="uno-decorative-line"></div>
<PostList posts={pinnedPosts} lang={lang} />
</section>
@ -47,7 +47,7 @@ const postsByYear = await getPostsByYear(lang)
<!-- Regular Posts -->
{[...postsByYear.entries()].map(([_year, posts]) => (
<section class="mb-7.5 lg:mb-9.5">
<section class="mb-7.5 lg:mb-10">
<div class="uno-decorative-line"></div>
<PostList posts={posts} lang={lang} />
</section>

View file

@ -103,9 +103,8 @@ const { Content, remarkPluginFrontmatter } = await post.render()
postSlug={post.slug}
supportedLangs={supportedLangs}
>
<!-- Title -->
<article class="heti mb-12.6">
<!-- Title -->
<h1 class="post-title">
<span
transition:name={`post-${post.data.abbrlink || post.slug}-${lang}`}
@ -127,6 +126,8 @@ const { Content, remarkPluginFrontmatter } = await post.render()
minutes={remarkPluginFrontmatter.minutes}
/>
</div>
<!-- Content -->
<Content />
</article>