mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## 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
132 lines
3.1 KiB
TypeScript
132 lines
3.1 KiB
TypeScript
'use client'
|
|
|
|
import { Minus, Plus } from 'lucide-react'
|
|
import * as React from 'react'
|
|
import { Bar, BarChart, ResponsiveContainer } from 'recharts'
|
|
import {
|
|
Button,
|
|
Drawer,
|
|
DrawerClose,
|
|
DrawerContent,
|
|
DrawerDescription,
|
|
DrawerFooter,
|
|
DrawerHeader,
|
|
DrawerTitle,
|
|
DrawerTrigger,
|
|
} from 'ui'
|
|
|
|
const data = [
|
|
{
|
|
goal: 400,
|
|
},
|
|
{
|
|
goal: 300,
|
|
},
|
|
{
|
|
goal: 200,
|
|
},
|
|
{
|
|
goal: 300,
|
|
},
|
|
{
|
|
goal: 200,
|
|
},
|
|
{
|
|
goal: 278,
|
|
},
|
|
{
|
|
goal: 189,
|
|
},
|
|
{
|
|
goal: 239,
|
|
},
|
|
{
|
|
goal: 300,
|
|
},
|
|
{
|
|
goal: 200,
|
|
},
|
|
{
|
|
goal: 278,
|
|
},
|
|
{
|
|
goal: 189,
|
|
},
|
|
{
|
|
goal: 349,
|
|
},
|
|
]
|
|
|
|
export default function DrawerDemo() {
|
|
const [goal, setGoal] = React.useState(350)
|
|
|
|
function onClick(adjustment: number) {
|
|
setGoal(Math.max(200, Math.min(400, goal + adjustment)))
|
|
}
|
|
|
|
return (
|
|
<Drawer>
|
|
<DrawerTrigger asChild>
|
|
<Button size="small">Open Drawer</Button>
|
|
</DrawerTrigger>
|
|
<DrawerContent>
|
|
<div className="mx-auto w-full max-w-sm">
|
|
<DrawerHeader>
|
|
<DrawerTitle>Move Goal</DrawerTitle>
|
|
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
|
|
</DrawerHeader>
|
|
<div className="p-4 pb-0">
|
|
<div className="flex items-center justify-center space-x-2">
|
|
<Button
|
|
variant="outline"
|
|
size="small"
|
|
className="h-8 w-8 shrink-0 rounded-full"
|
|
onClick={() => onClick(-10)}
|
|
disabled={goal <= 200}
|
|
>
|
|
<Minus className="h-4 w-4" />
|
|
<span className="sr-only">Decrease</span>
|
|
</Button>
|
|
<div className="flex-1 text-center">
|
|
<div className="text-7xl font-bold tracking-tighter">{goal}</div>
|
|
<div className="text-[0.70rem] uppercase text-muted-foreground">Calories/day</div>
|
|
</div>
|
|
<Button
|
|
variant="outline"
|
|
size="small"
|
|
className="h-8 w-8 shrink-0 rounded-full"
|
|
onClick={() => onClick(10)}
|
|
disabled={goal >= 400}
|
|
>
|
|
<Plus className="h-4 w-4" />
|
|
<span className="sr-only">Increase</span>
|
|
</Button>
|
|
</div>
|
|
<div className="mt-3 h-[120px]">
|
|
<ResponsiveContainer width="100%" height="100%">
|
|
<BarChart data={data}>
|
|
<Bar
|
|
dataKey="goal"
|
|
style={
|
|
{
|
|
fill: 'var(--foreground-default)',
|
|
opacity: 0.9,
|
|
} as React.CSSProperties
|
|
}
|
|
/>
|
|
</BarChart>
|
|
</ResponsiveContainer>
|
|
</div>
|
|
</div>
|
|
<DrawerFooter>
|
|
<Button variant="primary">Submit</Button>
|
|
<DrawerClose asChild>
|
|
<Button variant="outline">Cancel</Button>
|
|
</DrawerClose>
|
|
</DrawerFooter>
|
|
</div>
|
|
</DrawerContent>
|
|
</Drawer>
|
|
)
|
|
}
|