Skip to content

Commit ce7f0bd

Browse files
committed
fix: link icons pixel details
Set mailto icon to 1em me-1 and external arrow to 0.875em ms-1 default, each with mb-0.5 for custom pixel alignment, while remaining inline. Maz size applied of 1rem, limiting size but allowing to shrink for smaller text. Link's contained in ButtonLink are in a flex with gap, so appropriately margin override applied via `data-label='arrow'` selector. Uses inline-flex items-center, removes align-middle and bottom margins.
1 parent 45790bd commit ce7f0bd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/ui/Link.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
106106
{isMailto ? (
107107
<span className="text-nowrap">
108108
{!hideArrow && (
109-
<Mail className="mb-0.5 me-1 inline-block size-[1em] shrink-0" />
109+
<Mail className="!mb-0.5 me-1 inline-block size-[1em] shrink-0" />
110110
)}
111111
{children}
112112
</span>
@@ -118,8 +118,9 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
118118
</VisuallyHidden>
119119
{!hideArrow && !isMailto && (
120120
<ExternalLink
121+
data-label="arrow"
121122
className={cn(
122-
"ms-1 inline size-4 shrink-0 align-middle",
123+
"!mb-0.5 ms-1 inline-block size-[0.875em] max-h-4 max-w-4 shrink-0",
123124
twFlipForRtl
124125
)}
125126
/>

src/components/ui/buttons/Button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
166166
>
167167
<BaseLink
168168
ref={ref}
169-
className={cn("no-underline hover:no-underline", className)}
169+
className={cn(
170+
"no-underline hover:no-underline [&_[data-label='arrow']]:ms-0",
171+
className
172+
)}
170173
activeClassName=""
171174
{...linkProps}
172175
onClick={handleClick}

0 commit comments

Comments
 (0)