feat: 添加资源页深色模式支持

This commit is contained in:
2026-01-03 14:51:37 +08:00
parent 8c01303c6c
commit 720ca56eb3
3 changed files with 11 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
import { cn } from "@/lib/utils";
import { X } from "lucide-react";
interface ResourceBadgeProps extends React.HTMLProps<HTMLDivElement> {
@@ -10,23 +11,17 @@ export function ResourceBadge({ tag, editMode, onClose, ...props }: ResourceBadg
return (
<div
id={tag.name}
className="text-[10px] text-zinc-500 font-medium py-[1px] px-1.5 rounded-full flex items-center gap-1"
style={{
backgroundColor: (() => {
switch (tag.type) {
case 'os':
return '#dbedfd';
default:
return '#e4e4e7';
}
})()
}}
className={cn(
"text-[10px] text-zinc-500 dark:text-zinc-300 dark:border font-medium py-px px-1.5 rounded-full flex items-center gap-1",
'bg-[#e4e4e7] dark:bg-[#2d2d30]',
tag.type === 'os' || 'bg-[#dbedfd] dark:bg-[#1e3a5f]',
)}
{...props}
>
<span className="text-nowrap">{tag.name}</span>
{
editMode && (
<span onClick={() => onClose?.(tag.name)}><X className="w-3 h-3 text-zinc-800 cursor-pointer" /></span>
<span onClick={() => onClose?.(tag.name)}><X className="w-3 h-3 text-zinc-800 dark:text-zinc-200 cursor-pointer" /></span>
)
}
</div>