Files
Danny White 476d4a5851 refactor(ui): drop redundant Button variant="default" props (#50161)
## What kind of change does this PR introduce?

Mechanical cleanup on top of the Button default-variant change (#50160).

## What is the current behavior?

Many callsites still pass `variant="default"` even though that is now
the component default.

## What is the new behavior?

Removes redundant static `variant="default"` from legacy `Button` and
`ButtonTooltip` callsites. Keeps explicit defaults where they document
the API:

- `button-default.tsx` and `button-sizes.tsx` demos
- `DocsButton`, which pins neutral styling at the wrapper boundary

## To test

Studio:

- [Auth → Rate
Limits](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/auth/rate-limits):
dirty the form so Cancel appears; Cancel stays neutral, Save stays green
- [Project Settings → API
Keys](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/settings/api-keys):
`DocsButton` in the header actions stays neutral

Design system:

- [Design system →
Button](https://design-system-git-dnywh-dc924ac1-supabase.vercel.app/design-system/docs/components/button):
`button-default` / `button-sizes` still show explicit default styling;
Primary (green) is restricted to the Primary section (and `asChild`)

WWW:

- [www → Brand
assets](https://zone-www-dot-com-git-dnywh-dc924ac1-supabase.vercel.app/brand-assets):
Download logo kit / Download button kit stay neutral
2026-09-11 17:05:26 +10:00

97 lines
2.7 KiB
TypeScript

import { ExternalLink, Maximize2, Minimize2 } from 'lucide-react'
import Link from 'next/link'
import { forwardRef, ReactNode, useState } from 'react'
import { Button } from 'ui'
interface InformationBoxProps {
icon?: ReactNode
title: ReactNode | string
description?: ReactNode | string
url?: string
urlLabel?: string
defaultVisibility?: boolean
hideCollapse?: boolean
button?: React.ReactNode
className?: string
block?: boolean
}
/** @deprecated Use `Admonition` from 'ui-patterns' instead. */
const InformationBox = forwardRef<HTMLDivElement, InformationBoxProps>(
(
{
icon,
title,
description,
url,
urlLabel = 'Read more',
defaultVisibility = false,
hideCollapse = false,
button,
className = '',
block = false,
},
ref
) => {
const [isExpanded, setIsExpanded] = useState<boolean>(defaultVisibility)
return (
<div
ref={ref}
role="alert"
className={`${block ? 'block w-full' : ''}
block w-full rounded-md border bg-surface-300/25 py-3 ${className}`}
>
<div className="flex flex-col px-4">
<div className="flex items-center justify-between">
<div className="flex w-full space-x-3 items-center">
{icon && <span className="text-foreground-lighter">{icon}</span>}
<div className="grow">
<h5 className="text-foreground">{title}</h5>
</div>
</div>
{description && !hideCollapse ? (
<div
className="cursor-pointer text-foreground-lighter"
onClick={() => setIsExpanded(!isExpanded)}
>
{isExpanded ? (
<Minimize2 size={14} strokeWidth={1.5} />
) : (
<Maximize2 size={14} strokeWidth={1.5} />
)}
</div>
) : null}
</div>
{(description || url || button) && (
<div
className={`flex flex-col space-y-3 overflow-hidden transition-all ${
isExpanded ? 'mt-3' : ''
}`}
style={{ maxHeight: isExpanded ? 500 : 0 }}
>
<div className="text-foreground-light text-sm">{description}</div>
{url && (
<div>
<Button asChild icon={<ExternalLink />}>
<Link href={url} target="_blank" rel="noreferrer">
{urlLabel}
</Link>
</Button>
</div>
)}
{button && <div>{button}</div>}
</div>
)}
</div>
</div>
)
}
)
InformationBox.displayName = 'InformationBox'
export default InformationBox