2018-09-13 20:48:01 -07:00
|
|
|
import React from 'react';
|
2018-09-22 09:53:22 -07:00
|
|
|
import './style.less';
|
2019-02-23 13:46:35 -08:00
|
|
|
import Loader from 'components/Loader';
|
2018-09-13 20:48:01 -07:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
title?: React.ReactNode;
|
|
|
|
subtitle?: React.ReactNode;
|
|
|
|
style?: React.CSSProperties;
|
2019-02-23 13:46:35 -08:00
|
|
|
loading?: boolean;
|
2018-09-13 20:48:01 -07:00
|
|
|
}
|
|
|
|
|
2019-02-23 13:46:35 -08:00
|
|
|
const Placeholder: React.SFC<Props> = ({ style = {}, title, subtitle, loading }) => (
|
2019-03-14 20:26:28 -07:00
|
|
|
<div className={`Placeholder${(!!loading && ' is-loading') || ''}`} style={style}>
|
2019-02-23 13:46:35 -08:00
|
|
|
{(loading && <Loader inline={true} size="small" />) || (
|
|
|
|
<>
|
|
|
|
{title && <h3 className="Placeholder-title">{title}</h3>}
|
|
|
|
{subtitle && <div className="Placeholder-subtitle">{subtitle}</div>}
|
|
|
|
</>
|
|
|
|
)}
|
2018-09-22 09:53:22 -07:00
|
|
|
</div>
|
2018-09-13 20:48:01 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
export default Placeholder;
|