Skip to content

Commit

Permalink
fix: fix pages/archive.js eslint error && fix navbar component Link tag
Browse files Browse the repository at this point in the history
  • Loading branch information
real-jiakai committed Jul 24, 2024
1 parent 1557892 commit 2a8f560
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions components/Navbar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ export default function Navbar({ RenderThemeChanger }) {
</Link>
</li>
<li>
<a href="/archive" className="flex items-center hover:bg-gray-100 dark:hover:bg-gray-700">
<Link href="/archive" className="flex items-center hover:bg-gray-100 dark:hover:bg-gray-700">
<span className='mx-auto'>{archive}</span>
</a>
</Link>
</li>
<li>
<Link href="/about" className="flex items-center hover:bg-gray-100 dark:hover:bg-gray-700">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "next start",
"clean": "rm -rf .next",
"postbuild": "next-sitemap",
"lint": "next lint",
"lint": "next lint --fix",
"prepare": "husky install",
"pre-commit": "pnpm lint --fix && git add -A .",
"lint-staged": "lint-staged",
Expand Down
68 changes: 34 additions & 34 deletions pages/archive.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import Head from 'next/head';
import Link from 'next/link';
import Layout from 'components/Layout';
import { getSortedPostsData } from 'lib/posts';
import Head from 'next/head'
import Link from 'next/link'
import Layout from 'components/Layout'
import { getSortedPostsData } from 'lib/posts'

export async function getStaticProps() {
const allPostsData = getSortedPostsData();
return {
props: {
allPostsData,
},
};
const allPostsData = getSortedPostsData()
return {
props: {
allPostsData,
},
}
}

export default function Archive({ allPostsData }) {
return (
<Layout>
<Head>
<title>Archive</title>
</Head>
<section className="container mx-auto px-4 max-w-2xl">
<h1 className="text-3xl font-bold my-6 flex items-center dark:text-gray-100">
<span className="text-red-500 mr-2">📌</span>
return (
<Layout>
<Head>
<title>Archive</title>
</Head>
<section className="container mx-auto px-4 max-w-2xl">
<h1 className="text-3xl font-bold my-6 flex items-center dark:text-gray-100">
<span className="text-red-500 mr-2">📌</span>
Archive
</h1>
<ul className="space-y-4">
{allPostsData.map(({ date, slug, title }) => (
<li key={slug} className="border border-gray-200 rounded-lg p-3 flex items-center">
<span className="bg-blue-500 text-white text-xs font-semibold px-2 py-1 rounded mr-3 whitespace-nowrap">
{date}
</span>
<Link href={`/${date.split('-')[0]}/${date.split('-')[1]}/${slug}`}>
<span className="hover:underline cursor-pointer dark:text-gray-100">{title}</span>
</Link>
</li>
))}
</ul>
</section>
</Layout>
);
</h1>
<ul className="space-y-4">
{allPostsData.map(({ date, slug, title }) => (
<li key={slug} className="border border-gray-200 rounded-lg p-3 flex items-center">
<span className="bg-blue-500 text-white text-xs font-semibold px-2 py-1 rounded mr-3 whitespace-nowrap">
{date}
</span>
<Link href={`/${date.split('-')[0]}/${date.split('-')[1]}/${slug}`}>
<span className="hover:underline cursor-pointer dark:text-gray-100">{title}</span>
</Link>
</li>
))}
</ul>
</section>
</Layout>
)
}

0 comments on commit 2a8f560

Please sign in to comment.