Skip to content

Commit d3df7a1

Browse files
authored
fix styling, align the button without flex (#87)
1 parent ba34d7b commit d3df7a1

13 files changed

+365
-564
lines changed

src/features/accounts/components/account-link.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const AccountLink = fixedForwardRef(
2121
toast.success('Address copied to clipboard')
2222
}, [address])
2323
return (
24-
<div className={cn('inline-flex gap-2 items-center')}>
24+
<>
2525
<TemplatedNavLink
2626
className={cn(!children && 'text-primary underline', className)}
2727
urlTemplate={Urls.Explore.Account.ByAddress}
@@ -31,8 +31,8 @@ export const AccountLink = fixedForwardRef(
3131
>
3232
{children ? children : short ? <abbr title={address}>{ellipseAddress(address)}</abbr> : address}
3333
</TemplatedNavLink>
34-
{showCopyButton && <CopyButton onClick={copyClipboard} />}
35-
</div>
34+
{showCopyButton && <CopyButton onClick={copyClipboard} className={cn('align-middle ml-2')} />}
35+
</>
3636
)
3737
}
3838
)

src/features/assets/components/asset-link.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Link(props: AssetIdLinkProps | AssetIdAndNameLinkProps) {
3939
}, [props.assetId])
4040

4141
return (
42-
<div className={cn('inline-flex gap-2 items-center')}>
42+
<>
4343
<TemplatedNavLink
4444
className={cn(!props.children && 'text-primary underline', props.className)}
4545
urlTemplate={Urls.Explore.Asset.ById}
@@ -48,8 +48,8 @@ function Link(props: AssetIdLinkProps | AssetIdAndNameLinkProps) {
4848
{props.children ? props.children : props.assetId}
4949
</TemplatedNavLink>
5050
{'assetName' in props && props.assetName && ` (${props.assetName})`}
51-
{props.showCopyButton && <CopyButton onClick={copyClipboard} />}
52-
</div>
51+
{props.showCopyButton && <CopyButton onClick={copyClipboard} className={cn('align-middle ml-2')} />}
52+
</>
5353
)
5454
}
5555

src/features/common/components/button.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const buttonVariants = cva(
2222
sm: 'h-9 rounded-md px-3',
2323
lg: 'h-11 rounded-md px-8',
2424
icon: 'size-10',
25-
['sm-icon']: 'size-4',
2625
},
2726
},
2827
defaultVariants: {
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { CopyIcon } from 'lucide-react'
22
import { Button } from './button'
3+
import { cn } from '@/features/common/utils.ts'
34

45
type Props = {
56
onClick: () => void
7+
className?: string
68
}
79

810
export const copyButtonLabel = 'Copy'
911

10-
export function CopyButton({ onClick }: Props) {
12+
export function CopyButton({ onClick, className }: Props) {
1113
return (
12-
<Button onClick={onClick} variant="no-style" size="sm-icon" aria-label={copyButtonLabel} className="hover:bg-transparent">
13-
<CopyIcon className="size-4" />
14+
<Button onClick={onClick} variant="no-style" size="icon" aria-label={copyButtonLabel} className={cn('size-4', className)}>
15+
<CopyIcon size={'1rem'} />
1416
</Button>
1517
)
1618
}

0 commit comments

Comments
 (0)