chore: update navigator style

This commit is contained in:
Steven 2023-07-27 23:42:12 +08:00
parent 49cc1e9755
commit de51e1a8d3
3 changed files with 36 additions and 18 deletions

View File

@ -1,5 +1,5 @@
import classNames from "classnames";
import { uniq } from "lodash-es"; import { uniq } from "lodash-es";
import { Button } from "@mui/joy";
import { useAppSelector } from "../stores"; import { useAppSelector } from "../stores";
import useViewStore from "../stores/v1/view"; import useViewStore from "../stores/v1/view";
import Icon from "./Icon"; import Icon from "./Icon";
@ -12,36 +12,39 @@ const Navigator = () => {
const sortedTagMap = sortTags(tags); const sortedTagMap = sortTags(tags);
return ( return (
<div className="w-full flex flex-row justify-start items-center gap-1 flex-wrap mb-4"> <div className="w-full flex flex-row justify-start items-center mb-4 gap-1 sm:flex-wrap overflow-x-auto no-scrollbar">
<Button <button
variant={currentTab === "tab:all" ? "solid" : "plain"} className={classNames(
color="neutral" "flex flex-row justify-center items-center px-2 leading-7 text-sm rounded-md hover:bg-gray-200",
size="sm" currentTab === "tab:all" ? "!bg-gray-600 text-white shadow" : ""
)}
onClick={() => viewStore.setFilter({ tab: "tab:all" })} onClick={() => viewStore.setFilter({ tab: "tab:all" })}
> >
<Icon.CircleSlash className="w-4 h-auto mr-1" /> <Icon.CircleSlash className="w-4 h-auto mr-1" />
<span className="font-normal">All</span> <span className="font-normal">All</span>
</Button> </button>
<Button <button
variant={currentTab === "tab:mine" ? "solid" : "plain"} className={classNames(
color="neutral" "flex flex-row justify-center items-center px-2 leading-7 text-sm rounded-md hover:bg-gray-200",
size="sm" currentTab === "tab:mine" ? "!bg-gray-600 text-white shadow" : ""
)}
onClick={() => viewStore.setFilter({ tab: "tab:mine" })} onClick={() => viewStore.setFilter({ tab: "tab:mine" })}
> >
<Icon.User className="w-4 h-auto mr-1" /> <Icon.User className="w-4 h-auto mr-1" />
<span className="font-normal">Mine</span> <span className="font-normal">Mine</span>
</Button> </button>
{Array.from(sortedTagMap.keys()).map((tag) => ( {Array.from(sortedTagMap.keys()).map((tag) => (
<Button <button
key={tag} key={tag}
variant={currentTab === `tag:${tag}` ? "solid" : "plain"} className={classNames(
color="neutral" "flex flex-row justify-center items-center px-2 leading-7 text-sm rounded-md hover:bg-gray-200",
size="sm" currentTab === `tag:${tag}` ? "!bg-gray-600 text-white shadow" : ""
)}
onClick={() => viewStore.setFilter({ tab: `tag:${tag}`, tag: undefined })} onClick={() => viewStore.setFilter({ tab: `tag:${tag}`, tag: undefined })}
> >
<Icon.Hash className="w-4 h-auto mr-1" /> <Icon.Hash className="w-4 h-auto mr-1" />
<span className="max-w-[8rem] truncate font-normal">{tag}</span> <span className="max-w-[8rem] truncate font-normal">{tag}</span>
</Button> </button>
))} ))}
</div> </div>
); );

View File

@ -10,3 +10,18 @@ html,
"WenQuanYi Micro Hei", sans-serif, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "WenQuanYi Micro Hei", sans-serif, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji"; "Noto Color Emoji";
} }
@layer utilities {
@variants responsive {
/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}
}

View File

@ -43,7 +43,7 @@ const Home: React.FC = () => {
return ( return (
<> <>
<div className="mx-auto max-w-4xl w-full px-3 py-6 flex flex-col justify-start items-start"> <div className="mx-auto max-w-4xl w-full px-3 pt-4 pb-6 flex flex-col justify-start items-start">
<Navigator /> <Navigator />
<div className="w-full flex flex-row justify-between items-center mb-4"> <div className="w-full flex flex-row justify-between items-center mb-4">
<div className="flex flex-row justify-start items-center"> <div className="flex flex-row justify-start items-center">