mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 20:49:24 +00:00
refactor: clean some codes
This commit is contained in:
@@ -8,22 +8,24 @@ import { cn } from "@/lib/style";
|
||||
import { Indicator } from "@/components/indicator";
|
||||
|
||||
type Props = Pick<Tool, "Icon" | "shortTitle"> &
|
||||
Pick<LinkProps<unknown>, "className" | "href" | "onClick"> & {
|
||||
Pick<LinkProps<unknown>, "href" | "onClick"> & {
|
||||
highlight: "both" | "indicatorOnly" | "none";
|
||||
grouped?: true;
|
||||
};
|
||||
|
||||
function RawToolLink({ Icon, shortTitle: title, href, onClick, className, highlight }: Props) {
|
||||
// FIXME: css outline messed up
|
||||
function RawToolLink({ Icon, shortTitle: title, href, onClick, highlight, grouped }: Props) {
|
||||
return (
|
||||
<Link
|
||||
className={cn(
|
||||
"flex h-10 items-center gap-3 rounded",
|
||||
highlight === "both" && "bg-accent",
|
||||
"hover:bg-accent",
|
||||
className
|
||||
grouped && "pl-8 -outline-offset-1", // -outline-offset-1: ugly hack for Chrome outlines
|
||||
"hover:bg-accent"
|
||||
)}
|
||||
{...{ href, onClick }}
|
||||
>
|
||||
<span className={cn("invisible flex items-center", highlight !== "none" && "visible")}>
|
||||
<span className={cn("flex items-center", highlight === "none" && "invisible")}>
|
||||
<Indicator />
|
||||
</span>
|
||||
<span className="flex select-none items-center gap-4">
|
||||
|
||||
Reference in New Issue
Block a user