2019-08-09 14:56:43 +00:00
|
|
|
import React from "react";
|
2020-10-07 07:59:31 +00:00
|
|
|
import styled from "styled-components";
|
2019-08-09 14:56:43 +00:00
|
|
|
import PropTypes from "prop-types";
|
2020-10-05 13:20:33 +00:00
|
|
|
import Text from "../text";
|
2020-10-05 18:22:03 +00:00
|
|
|
import { mobile } from "../../utils/device";
|
2019-11-07 07:48:58 +00:00
|
|
|
|
|
|
|
const EmptyContentBody = styled.div`
|
2019-11-11 08:00:58 +00:00
|
|
|
margin: 0 auto;
|
2020-10-05 17:38:13 +00:00
|
|
|
padding: 64px 0;
|
2020-10-05 13:20:33 +00:00
|
|
|
|
|
|
|
display: grid;
|
|
|
|
grid-template-areas:
|
2020-10-07 07:59:31 +00:00
|
|
|
"img headerText"
|
2020-10-16 13:16:01 +00:00
|
|
|
${(props) => props.subheadingText && `"img subheadingText"`}
|
|
|
|
${(props) => props.descriptionText && `"img descriptionText"`}
|
2019-11-07 07:48:58 +00:00
|
|
|
"img button";
|
2020-10-05 17:38:13 +00:00
|
|
|
|
|
|
|
grid-column-gap: 16px;
|
2020-10-12 13:56:34 +00:00
|
|
|
grid-row-gap: 10px;
|
2020-10-07 07:59:31 +00:00
|
|
|
max-width: 800px;
|
2020-10-12 13:56:34 +00:00
|
|
|
grid-template-rows: max-content;
|
2019-11-07 08:48:18 +00:00
|
|
|
.ec-image {
|
|
|
|
grid-area: img;
|
2020-10-05 17:38:13 +00:00
|
|
|
margin: 0 0 0 auto;
|
2019-11-07 08:48:18 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 08:21:57 +00:00
|
|
|
.ec-header {
|
2020-10-07 07:59:31 +00:00
|
|
|
grid-area: headerText;
|
2020-10-12 13:56:34 +00:00
|
|
|
padding-top: 16px;
|
2019-11-07 07:48:58 +00:00
|
|
|
}
|
2020-10-05 13:20:33 +00:00
|
|
|
|
2020-04-14 10:27:42 +00:00
|
|
|
.ec-subheading {
|
2020-10-07 07:59:31 +00:00
|
|
|
grid-area: subheadingText;
|
2020-04-14 10:27:42 +00:00
|
|
|
}
|
2019-11-07 07:48:58 +00:00
|
|
|
|
2019-11-07 08:21:57 +00:00
|
|
|
.ec-desc {
|
2020-10-07 07:59:31 +00:00
|
|
|
grid-area: descriptionText;
|
2020-10-12 13:56:34 +00:00
|
|
|
line-height: 18px;
|
2019-11-07 08:21:57 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 08:48:18 +00:00
|
|
|
.ec-buttons {
|
2020-10-05 13:20:33 +00:00
|
|
|
grid-area: button;
|
2019-11-07 08:48:18 +00:00
|
|
|
}
|
|
|
|
|
2019-11-11 08:00:58 +00:00
|
|
|
@media (orientation: portrait) {
|
2020-10-12 13:56:34 +00:00
|
|
|
@media (max-width: 768px) {
|
2020-10-05 17:38:13 +00:00
|
|
|
padding-top: 0px;
|
2020-10-16 13:21:33 +00:00
|
|
|
max-width: 700px;
|
2020-10-05 18:22:03 +00:00
|
|
|
|
2019-11-11 08:00:58 +00:00
|
|
|
.ec-image {
|
2020-10-05 17:38:13 +00:00
|
|
|
max-height: 100px;
|
2019-11-11 08:00:58 +00:00
|
|
|
}
|
2019-11-07 08:21:57 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 18:22:03 +00:00
|
|
|
@media ${mobile} {
|
2020-10-07 07:59:31 +00:00
|
|
|
min-width: 343px;
|
2020-10-05 17:38:13 +00:00
|
|
|
grid-template-areas:
|
|
|
|
"img"
|
2020-10-07 07:59:31 +00:00
|
|
|
"headerText"
|
2020-10-16 13:16:01 +00:00
|
|
|
${(props) => props.subheadingText && `"subheadingText"`}
|
|
|
|
${(props) => props.descriptionText && `"descriptionText"`}
|
2020-10-05 17:38:13 +00:00
|
|
|
"button";
|
2020-10-07 07:59:31 +00:00
|
|
|
|
|
|
|
.ec-header {
|
|
|
|
padding-top: 0px;
|
2020-10-05 18:22:03 +00:00
|
|
|
}
|
2020-10-05 17:38:13 +00:00
|
|
|
.ec-header,
|
|
|
|
.ec-subheading,
|
|
|
|
.ec-desc,
|
|
|
|
.ec-buttons {
|
|
|
|
padding-left: 16px;
|
2019-11-11 08:00:58 +00:00
|
|
|
}
|
2020-10-07 07:59:31 +00:00
|
|
|
|
2020-10-05 17:38:13 +00:00
|
|
|
.ec-image {
|
2020-10-07 07:59:31 +00:00
|
|
|
height: 75px;
|
|
|
|
margin-left: 0;
|
2019-11-11 08:00:58 +00:00
|
|
|
}
|
2019-11-07 07:48:58 +00:00
|
|
|
}
|
2019-11-11 08:00:58 +00:00
|
|
|
}
|
2019-08-09 14:56:43 +00:00
|
|
|
`;
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
const EmptyContentImage = styled.img.attrs((props) => ({
|
2019-08-09 14:56:43 +00:00
|
|
|
src: props.imageSrc,
|
2020-10-16 13:16:01 +00:00
|
|
|
alt: props.imageAlt,
|
2019-08-09 14:56:43 +00:00
|
|
|
}))`
|
|
|
|
background: no-repeat 0 0 transparent;
|
|
|
|
`;
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
const EmptyScreenContainer = (props) => {
|
2020-10-05 13:20:33 +00:00
|
|
|
const {
|
|
|
|
imageSrc,
|
|
|
|
imageAlt,
|
|
|
|
headerText,
|
|
|
|
subheadingText,
|
|
|
|
descriptionText,
|
2020-10-16 13:16:01 +00:00
|
|
|
buttons,
|
2020-10-05 13:20:33 +00:00
|
|
|
} = props;
|
2019-08-09 14:56:43 +00:00
|
|
|
return (
|
2019-12-04 09:36:13 +00:00
|
|
|
<EmptyContentBody {...props}>
|
2020-10-05 13:20:33 +00:00
|
|
|
<EmptyContentImage
|
|
|
|
imageSrc={imageSrc}
|
|
|
|
imageAlt={imageAlt}
|
|
|
|
className="ec-image"
|
|
|
|
/>
|
2019-11-07 07:48:58 +00:00
|
|
|
|
2019-12-04 09:36:13 +00:00
|
|
|
{headerText && (
|
2020-10-05 13:20:33 +00:00
|
|
|
<Text as="span" fontSize="19px" fontWeight="600" className="ec-header">
|
|
|
|
{headerText}
|
|
|
|
</Text>
|
2019-12-04 09:36:13 +00:00
|
|
|
)}
|
2019-11-07 07:48:58 +00:00
|
|
|
|
2020-04-14 10:27:42 +00:00
|
|
|
{subheadingText && (
|
2020-10-05 13:20:33 +00:00
|
|
|
<Text as="span" fontWeight="600" className="ec-subheading">
|
|
|
|
{subheadingText}
|
|
|
|
</Text>
|
2020-04-14 10:27:42 +00:00
|
|
|
)}
|
|
|
|
|
2019-12-04 09:36:13 +00:00
|
|
|
{descriptionText && (
|
2020-10-05 13:20:33 +00:00
|
|
|
<Text as="span" color="#6A7378" fontSize="12px" className="ec-desc">
|
|
|
|
{descriptionText}
|
|
|
|
</Text>
|
2019-12-04 09:36:13 +00:00
|
|
|
)}
|
|
|
|
|
2020-10-05 13:20:33 +00:00
|
|
|
{buttons && <div className="ec-buttons">{buttons}</div>}
|
2019-12-04 09:36:13 +00:00
|
|
|
</EmptyContentBody>
|
2019-08-09 14:56:43 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
EmptyScreenContainer.propTypes = {
|
|
|
|
imageSrc: PropTypes.string,
|
|
|
|
imageAlt: PropTypes.string,
|
|
|
|
headerText: PropTypes.string,
|
2020-04-14 10:27:42 +00:00
|
|
|
subheadingText: PropTypes.string,
|
2019-08-09 14:56:43 +00:00
|
|
|
descriptionText: PropTypes.string,
|
2019-11-27 14:05:10 +00:00
|
|
|
buttons: PropTypes.any,
|
|
|
|
className: PropTypes.string,
|
|
|
|
id: PropTypes.string,
|
2020-10-16 13:16:01 +00:00
|
|
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
2019-08-09 14:56:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default EmptyScreenContainer;
|