Skip to content

Commit ce940d5

Browse files
sktbrdclaude
andauthored
fix(swap): sell amount renders at full size, not 14px (#286)
On the homepage swap section the amount you type rendered at 14px while the amount you receive rendered at 44px, in the same widget, a few pixels apart. The shadcn Input ships `md:text-sm`. tailwind-merge only evicts a conflicting class within the SAME modifier, so the widget's bare `text-[44px]` replaced `text-base` and left `md:text-sm` standing. Wherever the widget's container was under `@2xl` — the homepage column — nothing outbid it above 768px, and the sell field dropped to 14px. The full-width /swap page hid the bug because `@2xl:text-[56px]` applied there, and phones hid it because `md:` did not. Restating the size under `md:` is what actually evicts it. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent e25d100 commit ce940d5

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/app/[locale]/swap/SwapWidget.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import * as React from "react";
4-
import { ipfsToHttp } from "@/lib/ipfs";
54
import { useTranslations } from "next-intl";
65
import { useQuery } from "@tanstack/react-query";
76
import { getCoin, setApiKey } from "@zoralabs/coins-sdk";
@@ -24,6 +23,7 @@ import { Input } from "@/components/ui/input";
2423
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
2524
import { useUserAddress } from "@/hooks/use-user-address";
2625
import { useWriteAccount } from "@/hooks/use-write-account";
26+
import { ipfsToHttp } from "@/lib/ipfs";
2727
import { getThirdwebClient } from "@/lib/thirdweb";
2828
import { ensureOnChain, normalizeTxError } from "@/lib/thirdweb-tx";
2929
import { cn } from "@/lib/utils";
@@ -774,7 +774,15 @@ export function SwapWidget() {
774774
value={sellAmount}
775775
onChange={(e) => setSellAmount(e.target.value)}
776776
aria-label={t("from.sellAmount")}
777-
className="h-auto flex-1 border-0 bg-transparent p-0 text-[44px] font-thin leading-none tracking-[-2px] text-foreground shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/30 @2xl:text-[56px] @2xl:tracking-[-3px] dark:bg-transparent [appearance:textfield] [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none"
777+
// `md:text-[44px]` is not redundant with the base size: the
778+
// shadcn Input ships `md:text-sm`, and tailwind-merge only
779+
// drops a conflicting class within the SAME modifier — so the
780+
// bare `text-[44px]` replaced `text-base` and left `md:text-sm`
781+
// standing, which then won at ≥768px. The sell amount rendered
782+
// at 14px on desktop next to the buy amount's 44px, matching
783+
// only on phones. Restating it under `md:` is what actually
784+
// evicts it.
785+
className="h-auto flex-1 border-0 bg-transparent p-0 text-[44px] font-thin leading-none tracking-[-2px] text-foreground shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/30 md:text-[44px] @2xl:text-[56px] @2xl:tracking-[-3px] dark:bg-transparent [appearance:textfield] [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none"
778786
/>
779787
<span className="shrink-0 text-xl font-light tracking-tight text-muted-foreground/60 @2xl:text-2xl">
780788
{sellToken.symbol}

0 commit comments

Comments
 (0)