mirror of
https://github.com/supabase/supabase.git
synced 2026-09-22 13:37:53 +08:00
476d4a5851
## 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
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { useParams } from 'common'
|
|
import { Unlock } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { Button, Popover, PopoverContent, PopoverTrigger } from 'ui'
|
|
|
|
import { type Lint } from '@/data/lint/lint-query'
|
|
|
|
export const SecurityDefinerViewPopover = ({
|
|
lint,
|
|
onAutofix,
|
|
}: {
|
|
lint: Lint | null
|
|
onAutofix?: () => void
|
|
}) => {
|
|
const { ref } = useParams()
|
|
|
|
return (
|
|
<Popover modal={false}>
|
|
<PopoverTrigger asChild>
|
|
<Button variant="warning" icon={<Unlock strokeWidth={1.5} />}>
|
|
Security Definer view
|
|
</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent className="min-w-[395px] text-sm" align="end">
|
|
<h4 className="flex items-center gap-2">
|
|
<Unlock size={14} /> Secure your view
|
|
</h4>
|
|
<div className="grid gap-2 mt-2 text-foreground-light text-sm">
|
|
<p>
|
|
This view is defined with the Security Definer property, giving it permissions of the
|
|
view's creator (Postgres), rather than the permissions of the querying user.
|
|
</p>
|
|
|
|
<p>Since this view is in the public schema, it is accessible via your project's APIs.</p>
|
|
|
|
<div className="mt-2 flex items-center gap-2">
|
|
{!!onAutofix && (
|
|
<Button variant="secondary" onClick={onAutofix}>
|
|
Autofix
|
|
</Button>
|
|
)}
|
|
<Button asChild>
|
|
<Link
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={`/project/${ref}/advisors/security?preset=${lint?.level}&id=${lint?.cache_key}`}
|
|
>
|
|
Learn more
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|