import classnames from 'classnames' ; import m from 'mithril' ; import { Classes , IAttrs } from '../../_shared' ; import { Icon , IconName } from '../icon' ; export interface IEmptyStateAttrs extends IAttrs { /** Icon name */ icon ? : IconName | m . Children ; /** Header content */ header ? : m . Children ; /** Main content */ content ? : m . Children ; default fill ? : boolean ; [ htmlAttrs ] : any ; } export class EmptyState implements m . Component < IEmptyStateAttrs > { public view ( { attrs } ) { const { class : className , fill = true , icon , header , content , ... htmlAttrs } = attrs ; const classes = classnames ( Classes . EMPTY_STATE , fill && Classes . EMPTY_STATE_FILL , className ) ; const container = [ icon && m ( `.${ Classes . EMPTY_STATE_ICON }` , [ typeof icon === 'string' ? m ( Icon , { name : icon as IconName } ) : icon ] ) , header && m ( `.${ Classes . EMPTY_STATE_HEADER }` , header ) , content && m ( `.${ Classes . EMPTY_STATE_CONTENT }` , content ) ] ; return m ( '' , { ... htmlAttrs , class : classes } , container ) ; } }