index.js
45 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | import { __ } from '@wordpress/i18n' |
| 5 | |
| 6 | /** |
| 7 | * Internal dependencies |
| 8 | */ |
| 9 | import GiveHelpLink from '../help-link'; |
| 10 | import PlaceholderAnimation from '../placeholder-animation'; |
| 11 | import GiveIcon from '@givewp/components/GiveIcon'; |
| 12 | |
| 13 | const GiveBlankSlate = ( props ) => { |
| 14 | const { |
| 15 | noIcon, |
| 16 | isLoader, |
| 17 | title, |
| 18 | description, |
| 19 | children, |
| 20 | helpLink, |
| 21 | } = props; |
| 22 | |
| 23 | const blockLoading = ( |
| 24 | <PlaceholderAnimation /> |
| 25 | ); |
| 26 | |
| 27 | const blockLoaded = ( |
| 28 | <div className="block-loaded"> |
| 29 | { !! title && ( <h3 className="give-blank-slate__heading">{ title }</h3> ) } |
| 30 | { !! description && ( <p className="give-blank-slate__message">{ description }</p> ) } |
| 31 | { children } |
| 32 | { !! helpLink && ( <GiveHelpLink /> ) } |
| 33 | </div> |
| 34 | ); |
| 35 | |
| 36 | return ( |
| 37 | <div className="give-blank-slate"> |
| 38 | { ! noIcon && <GiveIcon size="80" className="give-blank-slate__image" /> } |
| 39 | { !! isLoader ? blockLoading : blockLoaded } |
| 40 | </div> |
| 41 | ); |
| 42 | }; |
| 43 | |
| 44 | export default GiveBlankSlate; |
| 45 |