1- import { Icon } from '@gravity-ui/uikit' ;
1+ import { Flex , Icon , Text } from '@gravity-ui/uikit' ;
22
33import { cn } from '../../utils/cn' ;
44
@@ -8,20 +8,22 @@ import './EmptyState.scss';
88
99const block = cn ( 'empty-state' ) ;
1010
11- const sizes = {
11+ export const EMPTY_STATE_SIZES = {
1212 xs : 100 ,
1313 s : 150 ,
14- m : 250 ,
14+ m : 230 ,
1515 l : 350 ,
1616} ;
1717
1818export interface EmptyStateProps {
19- title : string ;
19+ title : React . ReactNode ;
2020 image ?: React . ReactNode ;
2121 description ?: React . ReactNode ;
2222 actions ?: React . ReactNode [ ] ;
23- size ?: keyof typeof sizes ;
23+ size ?: keyof typeof EMPTY_STATE_SIZES ;
2424 position ?: 'left' | 'center' ;
25+ pageTitle ?: string ;
26+ className ?: string ;
2527}
2628
2729export const EmptyState = ( {
@@ -31,21 +33,33 @@ export const EmptyState = ({
3133 actions,
3234 size = 'm' ,
3335 position = 'center' ,
36+ pageTitle,
37+ className,
3438} : EmptyStateProps ) => {
3539 return (
36- < div className = { block ( { size} ) } >
40+ < div className = { block ( { size} , className ) } >
41+ { pageTitle ? < Text variant = "header-1" > { pageTitle } </ Text > : null }
3742 < div className = { block ( 'wrapper' , { size, position} ) } >
3843 < div className = { block ( 'image' ) } >
3944 { image ? (
4045 image
4146 ) : (
42- < Icon data = { emptyStateIcon } width = { sizes [ size ] } height = { sizes [ size ] } />
47+ < Icon
48+ data = { emptyStateIcon }
49+ width = { EMPTY_STATE_SIZES [ size ] }
50+ height = { EMPTY_STATE_SIZES [ size ] }
51+ />
4352 ) }
4453 </ div >
45-
46- < div className = { block ( 'title' , { size} ) } > { title } </ div >
47- < div className = { block ( 'description' ) } > { description } </ div >
48- < div className = { block ( 'actions' ) } > { actions } </ div >
54+ < Flex gap = { 5 } className = { block ( 'content' ) } direction = "column" >
55+ < Flex gap = { 3 } direction = "column" >
56+ < div className = { block ( 'title' , { size} ) } > { title } </ div >
57+ { description ? (
58+ < div className = { block ( 'description' ) } > { description } </ div >
59+ ) : null }
60+ </ Flex >
61+ { actions ? < Flex gap = { 2 } > { actions } </ Flex > : null }
62+ </ Flex >
4963 </ div >
5064 </ div >
5165 ) ;
0 commit comments