Improve some ui visual effects
This commit is contained in:
@@ -33,13 +33,9 @@ export const NavBar = () => {
|
||||
|
||||
return (
|
||||
<Sheet open={isSideNavOpen} onOpenChange={(open) => setIsSideNavOpen(open)}>
|
||||
<nav className="sticky top-0 z-50 flex flex-wrap justify-between py-3 backdrop-blur bg-white/50 dark:bg-black/50">
|
||||
<Link href="/" className="cursor-pointer">
|
||||
<h1
|
||||
className={`${fontFangZhengXiaoBiaoSongCN.className} my-auto border-b-4 border-b-black text-xl font-bold dark:border-b-white`}
|
||||
>
|
||||
{Config.SiteTitle}
|
||||
</h1>
|
||||
<nav className="sticky top-0 z-50 flex flex-wrap justify-between py-3 backdrop-blur bg-white/50 dark:bg-gray-950/50">
|
||||
<Link href="/" className="cursor-pointer my-auto text-xl font-bold">
|
||||
<h1 className={`${fontFangZhengXiaoBiaoSongCN.className}`}>{Config.SiteTitle}</h1>
|
||||
</Link>
|
||||
<div className="my-auto hidden sm:flex">
|
||||
{MenuItems.map((menuItem) => (
|
||||
@@ -67,20 +63,6 @@ export const NavBar = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap text-3xl space-x-2 sm:hidden">
|
||||
<Link
|
||||
title="Search the posts"
|
||||
className="my-auto rounded-full p-1 text-black hover:bg-gray-200 dark:text-gray-50 dark:hover:bg-gray-800"
|
||||
href="/search"
|
||||
>
|
||||
<MdSearch />
|
||||
</Link>
|
||||
<div
|
||||
title={theme === "light" ? "Switch to dark mode" : "Switch to light mode"}
|
||||
className="cursor-pointer rounded-full my-auto p-1 text-black hover:bg-gray-200 dark:text-gray-50 dark:hover:bg-gray-800"
|
||||
onClick={handleSwitchTheme}
|
||||
>
|
||||
{theme === "light" ? <MdOutlineDarkMode /> : <MdOutlineLightMode />}
|
||||
</div>
|
||||
<SheetTrigger
|
||||
title="Spread the navigation menu"
|
||||
className="text-black rounded-full p-1 hover:bg-gray-200 dark:text-gray-50 dark:hover:bg-gray-800"
|
||||
@@ -106,6 +88,22 @@ export const NavBar = () => {
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex justify-end text-3xl">
|
||||
<Link
|
||||
title="Search the posts"
|
||||
className="my-auto rounded-full p-1 text-black hover:bg-gray-200 dark:text-gray-50 dark:hover:bg-gray-800"
|
||||
href="/search"
|
||||
>
|
||||
<MdSearch />
|
||||
</Link>
|
||||
<div
|
||||
title={theme === "light" ? "Switch to dark mode" : "Switch to light mode"}
|
||||
className="cursor-pointer rounded-full my-auto p-1 text-black hover:bg-gray-200 dark:text-gray-50 dark:hover:bg-gray-800"
|
||||
onClick={handleSwitchTheme}
|
||||
>
|
||||
{theme === "light" ? <MdOutlineDarkMode /> : <MdOutlineLightMode />}
|
||||
</div>
|
||||
</div>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
);
|
||||
|
||||
@@ -9,17 +9,18 @@ export const PostList = (props: { data: TPostListItem[] }) => {
|
||||
return (
|
||||
<div>
|
||||
{props.data.map((postListItem, index) => (
|
||||
<div
|
||||
key={`post-list-${nanoid()}`}
|
||||
className={`${fontSourceSerifScreenCN.className} flex flex-col justify-center ${
|
||||
index !== props.data.length - 1 && "border-b"
|
||||
} border-gray-200 dark:border-gray-800 py-3`}
|
||||
>
|
||||
<Link className="hover:text-gray-600 dark:hover:text-gray-400" href={`/blog/${postListItem.id}`}>
|
||||
<div className="flex-center flex flex-col py-2 ">
|
||||
<h3 className="mx-auto text-xl font-extrabold capitalize">{postListItem.frontMatter.title}</h3>
|
||||
<Link className="cursor-pointer" href={`/blog/${postListItem.id}`} key={`post-list-${nanoid()}`}>
|
||||
<div
|
||||
className={`${fontSourceSerifScreenCN.className} flex flex-col justify-center ${
|
||||
index !== props.data.length - 1 && "border-b"
|
||||
} border-gray-200 hover:bg-gray-50 dark:hover:bg-gray-950 dark:border-gray-800 p-3`}
|
||||
>
|
||||
<div className="flex-center flex flex-col py-2">
|
||||
<h3 className="mx-auto text-lg font-extrabold capitalize">{postListItem.frontMatter.title}</h3>
|
||||
{postListItem.frontMatter.subtitle && (
|
||||
<div className="mx-auto text-base font-semibold capitalize">{postListItem.frontMatter.subtitle}</div>
|
||||
<div className="mx-auto text-base font-semibold capitalize text-gray-700 dark:text-gray-300">
|
||||
{postListItem.frontMatter.subtitle}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-center">{normalizeDate(postListItem.frontMatter.time)}</div>
|
||||
@@ -28,15 +29,15 @@ export const PostList = (props: { data: TPostListItem[] }) => {
|
||||
<p>{postListItem.frontMatter.summary}</p>
|
||||
</div>
|
||||
)}
|
||||
</Link>
|
||||
{postListItem.frontMatter.tags && (
|
||||
<div className="my-2 flex justify-center">
|
||||
{postListItem.frontMatter.tags.map((tagName) => (
|
||||
<TagBadge name={tagName} size="sm" key={`tags-${nanoid()}`} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{postListItem.frontMatter.tags && (
|
||||
<div className="my-2 flex justify-center">
|
||||
{postListItem.frontMatter.tags.map((tagName) => (
|
||||
<TagBadge name={tagName} size="sm" key={`tags-${nanoid()}`} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Link from "next/link";
|
||||
import { fontSourceSerifScreenCN } from "@/styles/font";
|
||||
|
||||
export const TagBadge = (props: { name: string; size: "sm" | "md"; count?: number }) => {
|
||||
return (
|
||||
<Link href={`/tags/${props.name}`} className={`mx-1 my-1 ${props.size === "sm" ? "text-sm" : "text-base"}`}>
|
||||
<div className="border-2 border-black px-2 hover:border-gray-600 hover:text-gray-600 dark:hover:text-gray-300 dark:border-white dark:text-white dark:hover:border-gray-300">
|
||||
{`${props.name}${props.count ? ` (${props.count})` : ""}`}
|
||||
</div>
|
||||
</Link>
|
||||
<div
|
||||
className={`mx-1 my-1 ${fontSourceSerifScreenCN.className} ${
|
||||
props.size === "sm" ? "text-sm" : "text-base"
|
||||
} border-2 border-black px-2 dark:border-white dark:text-white`}
|
||||
>
|
||||
{`${props.name}${props.count ? ` (${props.count})` : ""}`}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user