mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
chore: update Alert
This commit is contained in:
1 parent
1214557d32
commit
8c4a9429d3
2 files changed
+45
-16
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { Alert, AlertDescription, AlertTitle } from '@ui/components/shadcn/ui/alert'
|
||||
import { AlertCircle, Terminal, AlertTriangle } from 'lucide-react'
|
||||
import { AlertCircle, Terminal, AlertTriangle, Info } from 'lucide-react'
|
||||
import { Meta } from '@storybook/react'
|
||||
|
||||
const meta: Meta<typeof Alert> = {
|
||||
@@ -8,27 +8,37 @@ const meta: Meta<typeof Alert> = {
|
||||
}
|
||||
|
||||
export const Default = () => (
|
||||
<Alert className="flex gap-6">
|
||||
<div className="bg-foreground rounded h-5 w-5 flex items-center justify-center">
|
||||
<AlertTriangle className="h-3 w-3 text-background" strokeWidth={2} />
|
||||
</div>
|
||||
<div>
|
||||
<Alert>
|
||||
<Info strokeWidth={2} />
|
||||
<AlertTitle>Heads up!</AlertTitle>
|
||||
<AlertDescription>You can add components to your app using the cli.</AlertDescription>
|
||||
</div>
|
||||
<AlertDescription>You can add components to your app using the cli.</AlertDescription>
|
||||
</Alert>
|
||||
)
|
||||
|
||||
Default.storyName = 'Default'
|
||||
|
||||
export const Destructive = () => (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertTitle>Error</AlertTitle>
|
||||
<AlertDescription>Your session has expired. Please log in again.</AlertDescription>
|
||||
</Alert>
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertTitle>Error</AlertTitle>
|
||||
<AlertDescription>
|
||||
Your session has expired. Please log in again.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)
|
||||
|
||||
Destructive.storyName = 'Destructive'
|
||||
|
||||
export const Warning = () => (
|
||||
<Alert variant="warning">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertTitle>Error</AlertTitle>
|
||||
<AlertDescription>
|
||||
Your session has expired. Please log in again.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)
|
||||
|
||||
Warning.storyName = 'Warning'
|
||||
|
||||
export default meta
|
||||
@@ -3,14 +3,33 @@ import { cva, type VariantProps } from 'class-variance-authority'
|
||||
|
||||
import { cn } from '@ui/lib/utils'
|
||||
|
||||
|
||||
|
||||
const alertVariants = cva(
|
||||
'relative w-full rounded-lg border p-5 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-8',
|
||||
'relative w-full rounded-lg border p-4 [&:has(svg)]:pl-14 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground'
|
||||
// custom
|
||||
+ ' [&>svg]:w-[23px] [&>svg]:h-[23px] [&>svg]:p-1 [&>svg]:flex [&>svg]:rounded',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-alternative text-foreground',
|
||||
default:
|
||||
'text-foreground' +
|
||||
// removed `bg-background`
|
||||
|
||||
// custom styles
|
||||
' bg-alternative [&>svg]:text-background [&>svg]:bg-foreground-strong',
|
||||
destructive:
|
||||
'text-destructive border-destructive/50 [&>svg]:text-destructive text-destructive',
|
||||
'text-destructive' +
|
||||
// removed 'border-destructive/50 dark:border-destructive [&>svg]:text-destructive'
|
||||
|
||||
// custom styles
|
||||
' border-destructive-300 bg-destructive-400 [&>svg]:text-destructive-400 [&>svg]:bg-destructive',
|
||||
|
||||
/**
|
||||
* custom variant
|
||||
*/
|
||||
warning:
|
||||
'text-warning border-warning-300 bg-warning-400 [&>svg]:text-warning-400 [&>svg]:bg-warning',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
|
||||
Reference in new issue
Block a user