Skip to content

Commit 23bc485

Browse files
authored
clsx to cn (#109)
1 parent 801820b commit 23bc485

7 files changed

Lines changed: 13 additions & 21 deletions

File tree

components/button-with-dropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import clsx from "clsx";
21
import { ChevronDown } from "lucide-react";
32
import { type ReactNode, useState } from "react";
3+
import { cn } from "../lib/utils.js";
44
import { Button, type ButtonProps } from "./shadcn/button.js";
55
import {
66
DropdownMenu,
@@ -18,7 +18,7 @@ export function ButtonWithDropdown({ options, className, ...other }: Props) {
1818
const [isOpen, setIsOpen] = useState(false);
1919

2020
return (
21-
<div className={clsx("relative inline-block w-full", className)}>
21+
<div className={cn("relative inline-block w-full", className)}>
2222
<div className="flex">
2323
<Button {...other} />
2424
<DropdownMenu onOpenChange={setIsOpen}>
@@ -28,7 +28,7 @@ export function ButtonWithDropdown({ options, className, ...other }: Props) {
2828
className="relative before:absolute before:top-[10%] before:left-0 before:h-[80%] before:w-px before:bg-primary-foreground/30"
2929
>
3030
<ChevronDown
31-
className={clsx("h-5 w-5", isOpen && "rotate-180 transform")}
31+
className={cn("h-5 w-5", isOpen && "rotate-180 transform")}
3232
/>
3333
</Button>
3434
</DropdownMenuTrigger>

components/ethui-logo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clsx from "clsx";
1+
import { cn } from "../lib/utils.js";
22

33
interface Props {
44
size?: number;
@@ -29,7 +29,7 @@ export function EthuiLogo({
2929
className="cursor-pointer"
3030
>
3131
<title>ethui logo</title>
32-
<Background color={clsx(bg || (dev ? "fill-dev" : "fill-background"))} />
32+
<Background color={cn(bg || (dev ? "fill-dev" : "fill-background"))} />
3333
<DiamondTop color={fg} />
3434
<DiamondBottom color={fg} />
3535
{attention && <Attention color="fill-destructive" />}

components/form/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import clsx from "clsx";
21
import { Check, LoaderCircle, type LucideIcon, Save } from "lucide-react";
32
import { createElement } from "react";
43
import {
@@ -55,10 +54,7 @@ export function Form<S extends FieldValues>({
5554
<ShadForm {...form}>
5655
<form
5756
onSubmit={form.handleSubmit(onSubmit)}
58-
className={clsx(
59-
"flex flex-col items-start gap-2 align-start",
60-
className,
61-
)}
57+
className={cn("flex flex-col items-start gap-2 align-start", className)}
6258
{...props}
6359
>
6460
{children}

components/highlight-box.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clsx from "clsx";
1+
import { cn } from "../lib/utils.js";
22

33
export interface HighlightBoxProps {
44
children: React.ReactNode;
@@ -7,8 +7,6 @@ export interface HighlightBoxProps {
77

88
export function HighlightBox({ children, className }: HighlightBoxProps) {
99
return (
10-
<div className={clsx("max-w-full bg-accent p-2", className)}>
11-
{children}
12-
</div>
10+
<div className={cn("max-w-full bg-accent p-2", className)}>{children}</div>
1311
);
1412
}

components/icons/chain.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { clsx } from "clsx";
2-
31
import mainnet from "../../images/chains/1.webp";
42
import optimism from "../../images/chains/10.webp";
53
import polygon from "../../images/chains/137.webp";
@@ -47,7 +45,7 @@ export function ChainIcon({ chainId, className, status }: IconChainProps) {
4745
<div className="relative">
4846
<img
4947
alt={`Chain ${chainId}`}
50-
className={clsx("h-5 w-5", className)}
48+
className={cn("h-5 w-5", className)}
5149
src={Mappings[chainId] || unknown}
5250
/>
5351
{status && (

components/icons/effigy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import clsx from "clsx";
1+
import { cn } from "../../lib/utils.js";
22

33
export interface EffigyIconProps {
44
address: string;
@@ -10,7 +10,7 @@ export function EffigyIcon({ address, className }: EffigyIconProps) {
1010
return (
1111
<img
1212
alt={`Effigy for ${address}`}
13-
className={clsx("h-6 w-6", className)}
13+
className={cn("h-6 w-6", className)}
1414
src={`https://effigy.im/a/${address}.svg`}
1515
/>
1616
);

components/solidity-call.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Abi, AbiFunction, Address } from "abitype";
2-
import clsx from "clsx";
32
import { decodeFunctionData, formatUnits, parseAbi } from "viem";
3+
import { cn } from "../lib/utils.js";
44
import { ClickToCopy } from "./click-to-copy.js";
55

66
export interface SolidityCallProps {
@@ -203,7 +203,7 @@ function Arg({
203203
};
204204

205205
return (
206-
<div className={clsx("flex items-baseline px-1 py-0.5", variants[variant])}>
206+
<div className={cn("flex items-baseline px-1 py-0.5", variants[variant])}>
207207
{label && (
208208
<span className="mr-1 shrink-0 font-mono text-primary-background">
209209
{label}

0 commit comments

Comments
 (0)