Files
supabase/apps/studio/components/ui/BannerStack/Banners/BannerExplorer.tsx
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

94 lines
3.5 KiB
TypeScript

import { LOCAL_STORAGE_KEYS } from 'common'
import { AnimatePresence, motion } from 'framer-motion'
import { useEffect } from 'react'
import { Badge, Button } from 'ui'
import { BannerCard } from '../BannerCard'
import { useBannerStack } from '../BannerStackProvider'
import { useFeaturePreviewModal } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
import { useTrack } from '@/lib/telemetry/track'
let hasTrackedExposureThisPageLoad = false
export const BannerExplorer = () => {
const track = useTrack()
const { dismissBanner } = useBannerStack()
const { selectFeaturePreview } = useFeaturePreviewModal()
const [, setIsDismissed] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.EXPLORER_BANNER_DISMISSED,
false
)
useEffect(() => {
if (hasTrackedExposureThisPageLoad) return
hasTrackedExposureThisPageLoad = true
track('explorer_banner_exposed')
}, [track])
return (
<BannerCard
onDismiss={() => {
setIsDismissed(true)
dismissBanner('explorer-banner')
track('explorer_banner_dismiss_button_clicked')
}}
>
<div className="flex flex-col gap-y-4">
<div className="flex flex-col gap-y-2 items-start w-full">
<Badge variant="success" className="-ml-0.5 uppercase inline-flex items-center">
Preview
</Badge>
<AnimatePresence>
<div className="border h-27 w-full rounded-t-md mt-2 bg-surface-100 py-4 px-2 pb-0">
<motion.div
initial={{ opacity: 0, top: 10 }}
animate={{ opacity: 1, top: 0 }}
transition={{ delay: 0.5, duration: 0.2, ease: 'easeOut' }}
className="w-[90%] mx-auto"
>
<p className="text-[10px]">User growth</p>
<p className="text-[9px] text-foreground-lighter">
Track how your user base is trending.
</p>
</motion.div>
<motion.div
initial={{ opacity: 0, top: 10 }}
animate={{ opacity: 1, top: 0 }}
transition={{ delay: 1, duration: 0.2, ease: 'easeOut' }}
className="w-full h-13.5 border border-b-0 mt-2 rounded-t bg-surface-200 overflow-hidden"
>
<div className="h-3 w-full border-b" />
<p className="px-2 py-1 text-[8px] font-mono tracking-tighter flex flex-col">
<span className="text-code_block-1">select</span>
<span className="pl-2">date_trunc('week', last_sign_in_at) as week,</span>
<span className="pl-2">count(distinct id) as active_users</span>
</p>
</motion.div>
</div>
</AnimatePresence>
</div>
<div className="flex flex-col gap-y-1 mb-2">
<p className="text-sm font-medium">Explorer & Notebooks</p>
<p className="text-xs text-foreground-lighter text-balance">
New unified workspace for querying data and chatting with Assistant.
</p>
</div>
<div className="flex gap-2">
<Button
size="tiny"
onClick={() => {
selectFeaturePreview(LOCAL_STORAGE_KEYS.UI_PREVIEW_EXPLORER)
track('explorer_banner_cta_button_clicked')
}}
>
Enable Explorer
</Button>
</div>
</div>
</BannerCard>
)
}