Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Radius inconsistencies #3835

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/two-baboons-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
25 changes: 20 additions & 5 deletions packages/ui/src/primitives/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export const Root = React.forwardRef(function CardRoot(
return (
<div
ref={forwardedRef}
data-card-root=''
{...props}
className={cx(
'[--card-body-padding:theme(spacing.10)]',
'[--card-content-rounded-b:theme(borderRadius.lg)]',
'bg-gray-2 border-gray-a6 shadow-gray-a5 relative w-96 overflow-hidden rounded-xl border bg-clip-padding shadow-xl',
className,
)}
Expand All @@ -29,9 +31,10 @@ export const Content = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTM
return (
<div
ref={forwardedRef}
data-card-content=''
{...props}
className={cx(
'bg-gray-surface shadow-gray-a3 border-gray-a6 relative -m-px flex flex-col gap-8 rounded-[inherit] border p-[--card-body-padding] shadow-sm',
'bg-gray-surface shadow-gray-a3 border-gray-a6 relative -m-px flex flex-col gap-8 rounded-[inherit] rounded-b-[--card-content-rounded-b] border p-[--card-body-padding] shadow-sm',
className,
)}
>
Expand All @@ -47,6 +50,7 @@ export const Header = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTML
return (
<div
ref={forwardedRef}
data-card-header=''
{...props}
className={cx('z-1 flex flex-col gap-1 text-center', className)}
>
Expand All @@ -67,8 +71,9 @@ export const Logo = React.forwardRef(function Logo(
) {
const img = (
<img
crossOrigin='anonymous'
ref={forwardedRef}
data-card-logo=''
crossOrigin='anonymous'
{...props}
className={cx('max-h-24 max-w-24 object-contain', className)}
/>
Expand Down Expand Up @@ -96,6 +101,7 @@ export const Title = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<H
return (
<h2
ref={forwardedRef}
data-card-title=''
{...props}
className={cx('leading-medium text-gray-12 text-lg font-bold', className)}
>
Expand Down Expand Up @@ -125,8 +131,9 @@ export const Body = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDi
return (
<div
ref={forwardedRef}
data-card-body=''
{...props}
className={cx('z-1 flex flex-col gap-6 rounded-lg', className)}
className={cx('z-1 flex flex-col gap-6', className)}
>
{children}
</div>
Expand All @@ -138,12 +145,15 @@ export const Banner = React.forwardRef(function CardBanner(
forwardedRef: React.ForwardedRef<HTMLParagraphElement>,
) {
return (
<div className={cx('absolute inset-0 isolate')}>
<div
data-card-banner=''
className={cx('absolute inset-0 isolate')}
>
<div
className={cx(
'pointer-events-none absolute inset-0 w-full',
// manually nudge the radius by `1px` for a snug fit
'rounded-b-[calc(theme(borderRadius.xl)-0.0625rem)]',
'rounded-b-[calc(var(--card-content-rounded-b)-1px)]',
'[background-image:repeating-linear-gradient(-45deg,theme(colors.orange.50),theme(colors.orange.50)_6px,theme(colors.orange.100/0.75)_6px,theme(colors.orange.100/0.75)_12px)]',
'[mask-image:linear-gradient(to_top,black,transparent_128px)]',
)}
Expand All @@ -168,6 +178,7 @@ export const Footer = React.forwardRef(function Footer(
return branded || children ? (
<div
ref={forwardedRef}
data-card-footer=''
{...props}
className={cx('grid', className)}
>
Expand Down Expand Up @@ -196,6 +207,7 @@ export const FooterAction = React.forwardRef<HTMLDivElement, React.HTMLAttribute
return (
<div
ref={forwardedRef}
data-card-footer-action=''
{...props}
className={cx('border-gray-a6 border-b px-6 py-4 last-of-type:border-b-transparent', className)}
>
Expand All @@ -210,6 +222,7 @@ export const FooterActionText = React.forwardRef<HTMLParagraphElement, React.HTM
return (
<p
ref={forwardedRef}
data-card-footer-action-text=''
{...props}
className={cx('text-gray-a11 text-center text-base', className)}
>
Expand All @@ -226,6 +239,7 @@ export const FooterActionButton = React.forwardRef<HTMLButtonElement, React.Butt
return (
<button
ref={forwardedRef}
data-card-footer-action-button=''
// eslint-disable-next-line react/button-has-type
type={type}
className={footerActionButton({ className })}
Expand All @@ -242,6 +256,7 @@ export const FooterActionLink = React.forwardRef<HTMLAnchorElement, React.Anchor
return (
<a
ref={forwardedRef}
data-card-footer-action-link=''
{...props}
className={footerActionButton({ className })}
>
Expand Down
Loading