feat: replace editor icon with custom PNG using CSS mask

This commit is contained in:
SnapOtter
2026-05-17 11:47:39 +08:00
parent d693d5e762
commit 8ea4399739
3 changed files with 18 additions and 20 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -1,21 +1,19 @@
import type { SVGProps } from "react";
export function ImageEditIcon(props: SVGProps<SVGSVGElement>) {
export function ImageEditIcon({ className }: { className?: string }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<path d="M12 20H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7" />
<circle cx="8.5" cy="8.5" r="1.5" />
<path d="m3 20 4.5-4.5L10 18" />
<path d="m18.4 12.6-5.9 5.9-.5 2.5 2.5-.5 5.9-5.9a1.5 1.5 0 0 0-2.1-2.1z" />
</svg>
<span
className={className}
style={{
display: "inline-block",
backgroundColor: "currentColor",
maskImage: "url(/edit-image.png)",
maskSize: "contain",
maskRepeat: "no-repeat",
maskPosition: "center",
WebkitMaskImage: "url(/edit-image.png)",
WebkitMaskSize: "contain",
WebkitMaskRepeat: "no-repeat",
WebkitMaskPosition: "center",
}}
/>
);
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { FolderOpen, Grid3x3, HelpCircle, LayoutGrid, Settings, Workflow } from "lucide-react";
import type { ComponentType, SVGProps } from "react";
import type { ComponentType } from "react";
import { Link, useLocation } from "react-router-dom";
import { useTranslation } from "@/contexts/i18n-context";
import { cn } from "@/lib/utils";
@@ -7,7 +7,7 @@ import { ImageEditIcon } from "../common/image-edit-icon";
import { OtterLogo } from "../common/otter-logo";
interface SidebarItem {
icon: ComponentType<SVGProps<SVGSVGElement>>;
icon: ComponentType<{ className?: string }>;
label: string;
href?: string;
}