mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
code: tsx,nextjs,frontends (1 files)
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
'use client'
|
||||
|
||||
import { forwardRef, ReactNode } from 'react'
|
||||
import { Alert as MuiAlert, AlertTitle as MuiAlertTitle, AlertProps as MuiAlertProps } from '@mui/material'
|
||||
import { Alert as MuiAlert, AlertTitle as MuiAlertTitle, AlertProps as MuiAlertProps, SxProps, Theme } from '@mui/material'
|
||||
|
||||
export type AlertVariant = 'default' | 'destructive'
|
||||
|
||||
export interface AlertProps extends Omit<MuiAlertProps, 'variant' | 'severity'> {
|
||||
export interface AlertProps {
|
||||
variant?: AlertVariant
|
||||
children?: ReactNode
|
||||
className?: string
|
||||
sx?: SxProps<Theme>
|
||||
}
|
||||
|
||||
const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
||||
({ variant = 'default', children, sx, ...props }, ref) => {
|
||||
({ variant = 'default', children, className, sx, ...props }, ref) => {
|
||||
const severity = variant === 'destructive' ? 'error' : 'info'
|
||||
|
||||
return (
|
||||
@@ -19,6 +21,7 @@ const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
||||
ref={ref}
|
||||
severity={severity}
|
||||
variant="outlined"
|
||||
className={className}
|
||||
sx={{
|
||||
borderRadius: 2,
|
||||
...sx,
|
||||
|
||||
Reference in New Issue
Block a user