@@ -11,28 +11,43 @@ import { IAlertProps, TYPE } from '../types';
1111import { StyledAlert , StyledIcon } from '../styled' ;
1212import { validationIcons , validationHues } from '../utils/icons' ;
1313import { Hue , NotificationsContext } from '../utils/useNotificationsContext' ;
14+ import { Title } from './content/Title' ;
15+ import { Paragraph } from './content/Paragraph' ;
16+ import { Close } from './content/Close' ;
1417
15- /**
16- * @extends HTMLAttributes<HTMLDivElement>
17- */
18- export const Alert = React . forwardRef < HTMLDivElement , IAlertProps > ( ( { role, ...props } , ref ) => {
19- const hue = validationHues [ props . type ] ;
20- const Icon = validationIcons [ props . type ] as any ;
18+ export const AlertComponent = React . forwardRef < HTMLDivElement , IAlertProps > (
19+ ( { role, ...props } , ref ) => {
20+ const hue = validationHues [ props . type ] ;
21+ const Icon = validationIcons [ props . type ] as any ;
2122
22- return (
23- < NotificationsContext . Provider value = { hue as Hue } >
24- < StyledAlert ref = { ref } hue = { hue } role = { role === undefined ? 'alert' : role } { ...props } >
25- < StyledIcon hue = { hue } >
26- < Icon />
27- </ StyledIcon >
28- { props . children }
29- </ StyledAlert >
30- </ NotificationsContext . Provider >
31- ) ;
32- } ) ;
23+ return (
24+ < NotificationsContext . Provider value = { hue as Hue } >
25+ < StyledAlert ref = { ref } hue = { hue } role = { role === undefined ? 'alert' : role } { ...props } >
26+ < StyledIcon hue = { hue } >
27+ < Icon />
28+ </ StyledIcon >
29+ { props . children }
30+ </ StyledAlert >
31+ </ NotificationsContext . Provider >
32+ ) ;
33+ }
34+ ) ;
3335
34- Alert . displayName = 'Alert' ;
36+ AlertComponent . displayName = 'Alert' ;
3537
36- Alert . propTypes = {
38+ AlertComponent . propTypes = {
3739 type : PropTypes . oneOf ( TYPE ) . isRequired
3840} ;
41+
42+ /**
43+ * @extends HTMLAttributes<HTMLDivElement>
44+ */
45+ export const Alert = AlertComponent as typeof AlertComponent & {
46+ Close : typeof Close ;
47+ Paragraph : typeof Paragraph ;
48+ Title : typeof Title ;
49+ } ;
50+
51+ Alert . Close = Close ;
52+ Alert . Paragraph = Paragraph ;
53+ Alert . Title = Title ;
0 commit comments