1
- import PropTypes from 'prop-types ' ;
1
+ import { ReactNode } from 'react ' ;
2
2
import cn from 'bem-cn-lite' ;
3
+
3
4
import Icon from '../Icon/Icon' ;
4
5
5
6
import './EmptyState.scss' ;
@@ -12,7 +13,15 @@ const sizes = {
12
13
l : 350 ,
13
14
} ;
14
15
15
- export default function EmptyState ( { image, title, description, actions, size} ) {
16
+ interface EmptyStateProps {
17
+ title : string ;
18
+ image ?: ReactNode ;
19
+ description ?: ReactNode ;
20
+ actions ?: ReactNode [ ] ;
21
+ size ?: keyof typeof sizes ;
22
+ }
23
+
24
+ export const EmptyState = ( { image, title, description, actions, size = 'm' } : EmptyStateProps ) => {
16
25
return (
17
26
< div className = { block ( { size} ) } >
18
27
< div className = { block ( 'wrapper' , { size} ) } >
@@ -35,16 +44,4 @@ export default function EmptyState({image, title, description, actions, size}) {
35
44
</ div >
36
45
</ div >
37
46
) ;
38
- }
39
-
40
- EmptyState . propTypes = {
41
- title : PropTypes . string . isRequired ,
42
- image : PropTypes . node ,
43
- description : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . node ] ) ,
44
- actions : PropTypes . arrayOf ( PropTypes . node ) ,
45
- size : PropTypes . string ,
46
- } ;
47
-
48
- EmptyState . defaultProps = {
49
- size : 'm' ,
50
47
} ;
0 commit comments