Skip to content

Commit 5252ac3

Browse files
Refactor project structure and add new components
- Updated import paths in `projects.astro` for consistency. - Created `about-experience-item.astro` for displaying experience details. - Added `post-item.astro` for rendering individual posts with links and formatted dates. - Introduced `project-item.astro` for showcasing project details with images and links. - Developed `footer.astro` for consistent footer layout across pages. - Implemented `header.astro` for navigation with responsive design. - Added `logo.astro` for branding in the header. - Created `page-heading.astro` for standardized page headings. - Developed `related-posts.astro` for displaying related articles. - Implemented `toc.astro` for table of contents in posts. - Added UI components: `button.astro`, `formatted-date.astro`, `separator.astro`, `square-line.astro`, `square-lines.astro`, and `square.astro` for consistent styling. - Created `math-equation.mdx` for writing LaTeX math equations with KaTeX support.
1 parent 2e86e09 commit 5252ac3

29 files changed

Lines changed: 495 additions & 654 deletions

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode"],
3-
"unwantedRecommendations": []
2+
"recommendations": ["astro-build.astro-vscode", "unifiedjs.vscode-mdx"],
3+
"unwantedRecommendations": []
44
}

src/components/home/posts.astro

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
---
2-
import PostItem from "../post-item.astro";
3-
import Button from "../button.astro";
2+
import PostItem from "@/components/item/post-item.astro";
3+
import Button from "@/components/ui/button.astro";
44
import { get_feed_posts } from "@/utils/feed";
5+
import { USE_FEED } from "@/consts";
6+
import { getCollection } from "astro:content";
57
6-
const posts = await get_feed_posts();
7-
var feedUrl = "/rss.xml";
8+
const allPosts = await getCollection("post");
9+
10+
const { count } = Astro.props;
11+
12+
const sortedPosts = allPosts
13+
.map((post) => ({
14+
...post,
15+
date: post.data.pubDate,
16+
}))
17+
.sort((a, b) => b.date.getTime() - a.date.getTime());
18+
19+
const posts = USE_FEED
20+
? await get_feed_posts(3)
21+
: sortedPosts.slice(0, count).map((post) => {
22+
return {
23+
...(post.data || {}),
24+
link: `/post/${post.id}`,
25+
};
26+
});
827
---
928

1029
<section class="max-w-5xl mx-auto px-7 lg:px-0">

src/components/home/projects.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import projects from "../../collections/projects.json";
3-
import Button from "../button.astro";
4-
import Project from "../project.astro";
3+
import Button from "@/components/ui/button.astro";
4+
import Project from "@/components/item/project-item.astro";
55
---
66

77
<section class="max-w-5xl mx-auto px-7 lg:px-0">
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import Logo from "../components/logo.astro";
2+
import Logo from "@/components/layout/logo.astro";
33
---
44

55
<section
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
import menus from "../collections/menu.json";
3-
import Logo from "../components/logo.astro";
2+
import menus from "@/collections/menu.json";
3+
import Logo from "@/components/layout/logo.astro";
44
---
55

66
<!-- This is an invisible div with relative position so that it takes up the height of the menu (because menu is absolute/fixed) -->

0 commit comments

Comments
 (0)