delete post page
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
import Button from "../button.astro";
|
import Button from "../button.astro";
|
||||||
import PostsLoop from "../posts-loop.astro";
|
|
||||||
|
|
||||||
const feed = "https://feed.miantiao.me/";
|
const feed = "https://feed.miantiao.me/";
|
||||||
---
|
---
|
||||||
@@ -21,7 +20,6 @@ const feed = "https://feed.miantiao.me/";
|
|||||||
class="flex flex-col items-start justify-start md:flex-row md:space-x-7"
|
class="flex flex-col items-start justify-start md:flex-row md:space-x-7"
|
||||||
>
|
>
|
||||||
<div class="w-full md:w-2/3 space-y-7">
|
<div class="w-full md:w-2/3 space-y-7">
|
||||||
<PostsLoop count="3" />
|
|
||||||
|
|
||||||
<div class="flex items-center justify-center w-full py-5">
|
<div class="flex items-center justify-center w-full py-5">
|
||||||
<Button text="View All My Writing" link="/posts" />
|
<Button text="View All My Writing" link="/posts" />
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
---
|
|
||||||
import { getCollection } from "astro:content";
|
|
||||||
const allPosts = await getCollection("post");
|
|
||||||
|
|
||||||
const { count } = Astro.props;
|
|
||||||
|
|
||||||
function parseDate(dateStr) {
|
|
||||||
const [month, day, year] = dateStr.split(" ");
|
|
||||||
return new Date(`${month} ${parseInt(day)}, ${year}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const sortedPosts = allPosts
|
|
||||||
.map((post) => ({
|
|
||||||
...post,
|
|
||||||
date: parseDate(post.data.dateFormatted),
|
|
||||||
}))
|
|
||||||
.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
||||||
|
|
||||||
const postsLoop = sortedPosts.slice(0, count).map((post) => {
|
|
||||||
return {
|
|
||||||
...(post.data || {}),
|
|
||||||
link: `/post/${post.slug}`,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
---
|
|
||||||
|
|
||||||
{
|
|
||||||
postsLoop.map((post) => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
class="relative border border-transparent border-dashed cursor-pointer p-7 group rounded-2xl"
|
|
||||||
onclick={`location.href = '${post.link}'`}
|
|
||||||
>
|
|
||||||
<div class="absolute inset-0 z-20 w-full h-full duration-300 ease-out bg-white border border-dashed dark:bg-neutral-950 rounded-2xl border-neutral-300 dark:border-neutral-600 group-hover:-translate-x-1 group-hover:-translate-y-1" />
|
|
||||||
<div class="absolute inset-0 z-10 w-full h-full duration-300 ease-out border border-dashed rounded-2xl border-neutral-300 dark:border-neutral-600 group-hover:translate-x-1 group-hover:translate-y-1" />
|
|
||||||
<div class="relative z-30 duration-300 ease-out group-hover:-translate-x-1 group-hover:-translate-y-1">
|
|
||||||
<h2 class="flex items-center mb-3">
|
|
||||||
<a
|
|
||||||
href={post.link}
|
|
||||||
class="text-base font-bold leading-tight tracking-tight sm:text-lg dark:text-neutral-100"
|
|
||||||
>
|
|
||||||
{post.title}
|
|
||||||
</a>
|
|
||||||
<svg
|
|
||||||
class="group-hover:translate-x-0 flex-shrink-0 translate-y-0.5 -translate-x-1 w-2.5 h-2.5 stroke-current ml-1 transition-all ease-in-out duration-200 transform"
|
|
||||||
viewBox="0 0 13 15"
|
|
||||||
version="1.1"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
>
|
|
||||||
<g
|
|
||||||
stroke="none"
|
|
||||||
stroke-width="1"
|
|
||||||
fill="none"
|
|
||||||
fill-rule="evenodd"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
>
|
|
||||||
<g
|
|
||||||
id="svg"
|
|
||||||
transform="translate(0.666667, 2.333333)"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="2.4"
|
|
||||||
>
|
|
||||||
<g>
|
|
||||||
<>
|
|
||||||
<polyline
|
|
||||||
class="transition-all duration-200 ease-out opacity-0 delay-0 group-hover:opacity-100"
|
|
||||||
points="5.33333333 0 10.8333333 5.5 5.33333333 11"
|
|
||||||
/>
|
|
||||||
<line
|
|
||||||
class="transition-all duration-200 ease-out transform -translate-x-1 opacity-0 group-hover:translate-x-0 group-hover:opacity-100 group-hover:ml-0"
|
|
||||||
x1="10.8333333"
|
|
||||||
y1="5.5"
|
|
||||||
x2="0.833333333"
|
|
||||||
y2="5.16666667"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</h2>
|
|
||||||
<p class="text-sm text-neutral-600 dark:text-neutral-400">
|
|
||||||
<span>{post.description}</span>
|
|
||||||
</p>
|
|
||||||
<div class="mt-2.5 text-xs font-medium text-neutral-800 dark:text-neutral-300">
|
|
||||||
Posted on {post.dateFormatted}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -8,13 +8,11 @@ import Layout from "../layouts/main.astro";
|
|||||||
|
|
||||||
<Layout title="个人主页">
|
<Layout title="个人主页">
|
||||||
<div
|
<div
|
||||||
/* 1. 确保 max-w-7xl 与导航栏一致,并在大屏增加 px 保证呼吸感 */
|
|
||||||
class="relative z-20 w-full max-w-7xl mx-auto mt-16 px-7 md:mt-24 lg:mt-32 xl:px-10"
|
class="relative z-20 w-full max-w-7xl mx-auto mt-16 px-7 md:mt-24 lg:mt-32 xl:px-10"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col items-center md:flex-row">
|
<div class="flex flex-col items-center md:flex-row">
|
||||||
<div class="relative w-full md:w-1/2">
|
<div class="relative w-full md:w-1/2">
|
||||||
<h1
|
<h1
|
||||||
/* 2. 这里的字体大小可以再大胆一点,配合加宽后的布局 */
|
|
||||||
class="mb-5 text-4xl font-bold leading-tight md:text-5xl lg:text-7xl dark:text-white"
|
class="mb-5 text-4xl font-bold leading-tight md:text-5xl lg:text-7xl dark:text-white"
|
||||||
>
|
>
|
||||||
Hello, I'm Bi.
|
Hello, I'm Bi.
|
||||||
@@ -44,7 +42,6 @@ import Layout from "../layouts/main.astro";
|
|||||||
src="/assets/images/photo.png"
|
src="/assets/images/photo.png"
|
||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="auto"
|
decoding="auto"
|
||||||
/* 3. 关键修改:将 md:max-w-md 改为 md:max-w-lg 或直接取消限制,让图片随容器变大 */
|
|
||||||
class="relative z-30 w-full aspect-[790/1189] md:max-w-lg ml-auto dark:-translate-y-0.5"
|
class="relative z-30 w-full aspect-[790/1189] md:max-w-lg ml-auto dark:-translate-y-0.5"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
import PageHeading from "../components/page-heading.astro";
|
import PageHeading from "../components/page-heading.astro";
|
||||||
import PostsLoop from "../components/posts-loop.astro";
|
|
||||||
import Layout from "../layouts/main.astro";
|
import Layout from "../layouts/main.astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -12,7 +11,6 @@ import Layout from "../layouts/main.astro";
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="z-50 flex flex-col items-stretch w-full gap-5 my-8">
|
<div class="z-50 flex flex-col items-stretch w-full gap-5 my-8">
|
||||||
<PostsLoop count="999999999" />
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user