style: 优化移动端ui
This commit is contained in:
@@ -3,6 +3,7 @@ import {siteConfig} from "@/consts.ts";
|
|||||||
import PostList from "@/components/Post/List.astro";
|
import PostList from "@/components/Post/List.astro";
|
||||||
import Pagination from "@/components/Post/Pagination.astro";
|
import Pagination from "@/components/Post/Pagination.astro";
|
||||||
import type {Post} from "@/types";
|
import type {Post} from "@/types";
|
||||||
|
import PageHeader from "@/components/PageHeader.astro";
|
||||||
|
|
||||||
const {siteTitle} = siteConfig;
|
const {siteTitle} = siteConfig;
|
||||||
|
|
||||||
@@ -16,22 +17,12 @@ const {posts, page, totalPage} = Astro.props
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<header>
|
<PageHeader/>
|
||||||
<div class="top">
|
|
||||||
<h1>{siteTitle}</h1>
|
|
||||||
<!--<nav>-->
|
|
||||||
<!-- <span>归档</span>-->
|
|
||||||
<!-- <span>/</span>-->
|
|
||||||
<!-- <span>标签</span>-->
|
|
||||||
<!-- <span>/</span>-->
|
|
||||||
<!-- <span>关于</span>-->
|
|
||||||
<!--</nav>-->
|
|
||||||
</div>
|
|
||||||
<div class="intro">
|
<div class="intro">
|
||||||
<p>did you stand too close to the fire?<br>
|
<p>did you stand too close to the fire?<br>
|
||||||
like a liar looking for forgiveness from a stone.</p>
|
like a liar looking for forgiveness from a stone.</p>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<PostList posts={posts}/>
|
<PostList posts={posts}/>
|
||||||
@@ -53,24 +44,6 @@ const {posts, page, totalPage} = Astro.props
|
|||||||
gap: 24px;
|
gap: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
margin-top: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
border-bottom: var(--border-primary);
|
|
||||||
padding-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
@@ -79,11 +52,12 @@ const {posts, page, totalPage} = Astro.props
|
|||||||
}
|
}
|
||||||
|
|
||||||
.intro {
|
.intro {
|
||||||
padding: 28px 0;
|
|
||||||
border-bottom: var(--border-secondary);
|
border-bottom: var(--border-secondary);
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
|
padding-bottom: 32px;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
@@ -104,4 +78,15 @@ const {posts, page, totalPage} = Astro.props
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
color: var(--text-tertiary);
|
color: var(--text-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.page-content {
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
height: 64px;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
38
src/components/PageHeader.astro
Normal file
38
src/components/PageHeader.astro
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
import {siteConfig} from "@/consts.ts";
|
||||||
|
const {siteTitle} = siteConfig;
|
||||||
|
---
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<a href="/"><h1>{siteTitle}</h1></a>
|
||||||
|
<!--<nav>-->
|
||||||
|
<!-- <span>归档</span>-->
|
||||||
|
<!-- <span>/</span>-->
|
||||||
|
<!-- <span>标签</span>-->
|
||||||
|
<!-- <span>/</span>-->
|
||||||
|
<!-- <span>关于</span>-->
|
||||||
|
<!--</nav>-->
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: var(--border-primary);
|
||||||
|
margin-top: 32px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
header {
|
||||||
|
margin-top: 24px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -39,7 +39,7 @@ const {posts} = Astro.props
|
|||||||
}
|
}
|
||||||
|
|
||||||
.post h2 {
|
.post h2 {
|
||||||
font-size: 17px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import "@/styles/github-markdown-reset.css";
|
|||||||
import "photoswipe/dist/photoswipe.css";
|
import "photoswipe/dist/photoswipe.css";
|
||||||
|
|
||||||
import Layout from '@/layouts/Layout.astro';
|
import Layout from '@/layouts/Layout.astro';
|
||||||
|
import PageHeader from '@/components/PageHeader.astro';
|
||||||
import {createHttp} from "@/lib/request.ts";
|
import {createHttp} from "@/lib/request.ts";
|
||||||
import type {Post} from "@/types";
|
import type {Post} from "@/types";
|
||||||
import {processHtmlWithJsdom} from "@/lib/processHtml.ts";
|
import {processHtmlWithJsdom} from "@/lib/processHtml.ts";
|
||||||
@@ -31,10 +32,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
|
|||||||
|
|
||||||
<Layout title={data.title} description="">
|
<Layout title={data.title} description="">
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<nav class="nav">
|
<PageHeader />
|
||||||
<a class="nav-title" href="/">{siteTitle}</a>
|
|
||||||
<a href="/">← 返回首页</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
@@ -69,39 +67,18 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.page-container {
|
.page-container {
|
||||||
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
|
||||||
flex-shrink: 0;
|
|
||||||
margin: 0 auto;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 13px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav a {
|
|
||||||
color: #999;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-title {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav a:hover {
|
|
||||||
color: #24292e;
|
|
||||||
}
|
|
||||||
|
|
||||||
article {
|
article {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 48px 0 0;
|
padding: 24px 0 24px 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
@@ -125,7 +102,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 32px;
|
font-size: 28px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
margin: 20px 0 20px;
|
margin: 20px 0 20px;
|
||||||
@@ -149,7 +126,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tags {
|
.tags {
|
||||||
margin-top: 44px;
|
margin-top: 24px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -166,7 +143,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
|
|||||||
footer{
|
footer{
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 44px;
|
margin-top: 24px;
|
||||||
border-top: var(--border-secondary);
|
border-top: var(--border-secondary);
|
||||||
height: 66px;
|
height: 66px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user