1- import React from " react" ;
2- import { positions , types } from " react-alert" ;
3- import clsx from " clsx" ;
4- import CloseImg from " ./close.svg" ;
5- import InfoImg from " ./info.svg" ;
6- import SuccessImg from " ./success.svg" ;
7- import ErrorImg from " ./error.svg" ;
8- import Text from " @site/src/components/Text" ;
9- import styles from " ./alert.module.scss" ;
1+ import React from ' react'
2+ import { positions , types } from ' react-alert'
3+ import clsx from ' clsx'
4+ import CloseImg from ' ./close.svg'
5+ import InfoImg from ' ./info.svg'
6+ import SuccessImg from ' ./success.svg'
7+ import ErrorImg from ' ./error.svg'
8+ import Text from ' @site/src/components/Text'
9+ import styles from ' ./alert.module.scss'
1010
1111export const options = {
1212 position : positions . TOP_CENTER ,
1313 timeout : 10000 ,
14- offset : " 5px" ,
14+ offset : ' 5px' ,
1515 containerStyle : {
1616 zIndex : 1000 ,
1717 marginTop : 64 ,
1818 } ,
19- } ;
19+ }
2020
2121export const AlertTemplate = ( { style, options, message, close } ) => {
2222 const handleCloseAlert = ( ) => {
23- close ( ) ;
24- } ;
23+ close ( )
24+ }
2525
2626 return (
2727 < div
@@ -30,9 +30,8 @@ export const AlertTemplate = ({ style, options, message, close }) => {
3030 styles . alert ,
3131 options . type === types . INFO && styles . info ,
3232 options . type === types . SUCCESS && styles . success ,
33- options . type === types . ERROR && styles . error ,
34- ) }
35- >
33+ options . type === types . ERROR && styles . error
34+ ) } >
3635 { options . type === types . INFO && < InfoImg className = { styles . icon } /> }
3736 { options . type === types . SUCCESS && < SuccessImg className = { styles . icon } /> }
3837 { options . type === types . ERROR && < ErrorImg className = { styles . icon } /> }
@@ -41,30 +40,21 @@ export const AlertTemplate = ({ style, options, message, close }) => {
4140 role = "button"
4241 data-testid = "alert-close"
4342 onClick = { handleCloseAlert }
44- className = { styles . closeButton }
45- >
43+ className = { styles . closeButton } >
4644 < CloseImg className = { styles . closeIcon } />
4745 </ span >
4846 </ div >
49- ) ;
50- } ;
47+ )
48+ }
5149
52- export const AlertTitle = ( {
53- children,
54- } : {
55- children : string | React . ReactElement ;
56- } ) => (
50+ export const AlertTitle = ( { children } : { children : string | React . ReactElement } ) => (
5751 < Text as = "p" className = { styles . alertTitle } >
5852 { children }
5953 </ Text >
60- ) ;
54+ )
6155
62- export const AlertText = ( {
63- children,
64- } : {
65- children : string | React . ReactElement ;
66- } ) => (
56+ export const AlertText = ( { children } : { children : string | React . ReactElement } ) => (
6757 < Text as = "p" className = { styles . alertText } >
6858 { children }
6959 </ Text >
70- ) ;
60+ )
0 commit comments