feat: rounded post sorting button

This commit is contained in:
DIYgod
2023-09-22 21:34:22 +08:00
parent 3838e2e532
commit 0ff22c2a49
4 changed files with 15 additions and 6 deletions
+12 -3
View File
@@ -21,9 +21,11 @@ export type TabItem = {
export const Tabs = ({
items,
className,
type,
}: {
items: TabItem[]
className?: string
type?: "rounded" | "bordered"
}) => {
const { t } = useTranslation("dashboard")
const pathname = usePathname()
@@ -38,7 +40,8 @@ export const Tabs = ({
return (
<div
className={cn(
"flex border-b space-x-5 mb-8 overflow-x-auto scrollbar-hide",
"flex mb-8 overflow-x-auto scrollbar-hide",
type === "rounded" ? "space-x-3 text-sm" : "space-x-5 border-b",
className,
)}
>
@@ -52,8 +55,14 @@ export const Tabs = ({
key={item.text}
className={cn(
"inline-flex items-center h-10 whitespace-nowrap cursor-pointer transition-colors focus-ring relative",
"after:absolute after:h-[2px] after:transition-[left,right] after:bottom-0",
item.active
type === "rounded"
? "rounded-full h-8 px-3 transition-colors"
: "after:absolute after:h-[2px] after:transition-[left,right] after:bottom-0",
type === "rounded"
? item.active
? "bg-zinc-950 text-white"
: "bg-zinc-100 text-zinc-800 hover:bg-zinc-200"
: item.active
? "text-black font-medium after:left-0 after:right-0 after:bg-accent"
: "text-gray-500 hover:text-gray-700 after:left-1/2 after:right-1/2 hover:after:left-0 hover:after:right-0 after:bg-gray-700",
)}