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