/
Alert.tsx
38 lines (35 loc) · 944 Bytes
/
Alert.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react'
import { Box, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'
export type AlertProps = BoxProps
/**
* Component for displaying messages, notifications, or other application state.
*
* Alert variants can be defined in `theme.alerts`.
* The Alert component uses `theme.alerts.primary` as its default variant.
*/
export const Alert: ForwardRef<HTMLDivElement, AlertProps> = React.forwardRef(
function Alert(props, ref) {
return (
<Box
ref={ref}
variant="primary"
{...props}
{...__internalProps({
__themeKey: 'alerts',
__css: {
display: 'flex',
alignItems: 'center',
px: 3,
py: 2,
fontWeight: 'bold',
color: 'white',
bg: 'primary',
borderRadius: 4,
},
})}
/>
)
}
)