Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

feat(web): restyle tag pills on the tags page for light and dark mode

Mohamed Bassem1a09423a1522
diff --git a/apps/web/components/dashboard/tags/MultiTagSelector.tsx b/apps/web/components/dashboard/tags/MultiTagSelector.tsx
index 1083c17c..0c34bfe0 100644
--- a/apps/web/components/dashboard/tags/MultiTagSelector.tsx
+++ b/apps/web/components/dashboard/tags/MultiTagSelector.tsx
@@ -1,9 +1,7 @@
import React from "react";
-import { Separator } from "@/components/ui/separator";
import useBulkTagActionsStore from "@/lib/bulkTagActions";
import { cn } from "@/lib/utils";
import { Check } from "lucide-react";
-import { useTheme } from "next-themes";
export const MultiTagSelector = React.memo(function MultiTagSelector({
id,
@@ -15,43 +13,40 @@ export const MultiTagSelector = React.memo(function MultiTagSelector({
count: number;
}) {
const toggleTag = useBulkTagActionsStore((state) => state.toggleTag);
- const { resolvedTheme } = useTheme();
const isSelected = useBulkTagActionsStore((state) => state.isTagSelected(id));
- const getIconColor = () => {
- if (resolvedTheme === "dark") {
- return isSelected ? "black" : "white";
- }
- return isSelected ? "white" : "black";
- };
-
- const getIconBackgroundColor = () => {
- if (resolvedTheme === "dark") {
- return isSelected ? "bg-white" : "bg-white bg-opacity-10";
- }
- return isSelected ? "bg-black" : "bg-white";
- };
-
const pill = (
<div className="group relative flex">
<button
className={cn(
- "flex gap-2 rounded-md border border-border px-2 py-1",
+ "inline-flex items-center gap-2 rounded-full border py-1 pl-3 pr-1 text-sm font-medium transition-colors",
isSelected
- ? "bg-black bg-opacity-10"
- : "bg-background text-foreground hover:bg-foreground hover:text-background",
+ ? "border-primary/40 bg-primary/10 text-foreground dark:border-primary/50 dark:bg-primary/15"
+ : "border-border bg-secondary/60 text-foreground hover:border-foreground/15 hover:bg-secondary dark:border-white/[0.06] dark:bg-white/[0.04] dark:hover:border-white/[0.12] dark:hover:bg-white/[0.08]",
)}
data-id={id}
onClick={() => toggleTag(id)}
>
- {name} <Separator orientation="vertical" /> {count}
+ {name}
+ <span
+ className={cn(
+ "min-w-6 rounded-full px-1.5 py-0.5 text-center text-xs tabular-nums transition-colors",
+ isSelected
+ ? "bg-primary/15 text-foreground dark:bg-primary/25"
+ : "bg-background text-muted-foreground group-hover:text-foreground dark:bg-white/[0.06]",
+ )}
+ >
+ {count}
+ </span>
<div
className={cn(
- "absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full border border-gray-600",
- getIconBackgroundColor(),
+ "absolute -right-1.5 -top-1.5 flex size-4 items-center justify-center rounded-full border shadow-sm transition-colors",
+ isSelected
+ ? "border-primary bg-primary text-primary-foreground"
+ : "border-border bg-background text-transparent group-hover:text-muted-foreground dark:border-white/20 dark:bg-card",
)}
>
- <Check size={12} color={getIconColor()} />
+ <Check className="size-3" strokeWidth={3} />
</div>
</button>
</div>
diff --git a/apps/web/components/dashboard/tags/TagPill.tsx b/apps/web/components/dashboard/tags/TagPill.tsx
index 09310f9f..d33cb4f3 100644
--- a/apps/web/components/dashboard/tags/TagPill.tsx
+++ b/apps/web/components/dashboard/tags/TagPill.tsx
@@ -1,7 +1,6 @@
import React, { useRef, useState } from "react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
-import { Separator } from "@/components/ui/separator";
import { toast } from "@/components/ui/sonner";
import { useDragAndDrop } from "@/lib/drag-and-drop";
import { X } from "lucide-react";
@@ -78,22 +77,23 @@ export const TagPill = React.memo(function TagPill({
ref={draggableRef}
>
<Link
- className={
- "flex gap-2 rounded-md border border-border bg-background px-2 py-1 text-foreground hover:bg-foreground hover:text-background"
- }
+ className="inline-flex items-center gap-2 rounded-full border border-border bg-secondary/60 py-1 pl-3 pr-1 text-sm font-medium text-foreground transition-colors hover:border-foreground/15 hover:bg-secondary dark:border-white/[0.06] dark:bg-white/[0.04] dark:hover:border-white/[0.12] dark:hover:bg-white/[0.08]"
href={`/dashboard/tags/${id}`}
data-id={id}
draggable={false}
prefetch={false}
>
- {name} <Separator orientation="vertical" /> {count}
+ {name}
+ <span className="min-w-6 rounded-full bg-background px-1.5 py-0.5 text-center text-xs tabular-nums text-muted-foreground transition-colors group-hover:text-foreground dark:bg-white/[0.06]">
+ {count}
+ </span>
</Link>
{isHovered && !isDraggable && (
<Button
size="none"
variant="secondary"
- className="-translate-1/2 absolute -right-1 -top-1 hidden rounded-full group-hover:block"
+ className="absolute -right-1.5 -top-1.5 hidden rounded-full border border-border bg-background p-0.5 text-muted-foreground shadow-sm hover:bg-destructive hover:text-destructive-foreground group-hover:block"
onClick={() => onOpenDialog({ id, name })}
>
<X className="size-3" />