saleor-dashboard/src/home/components/HomeHeader/HomeHeader.tsx

61 lines
1.5 KiB
TypeScript
Raw Normal View History

2019-10-30 14:34:24 +00:00
import { makeStyles } from "@material-ui/core/styles";
2019-06-19 14:40:52 +00:00
import Typography from "@material-ui/core/Typography";
2019-08-09 10:26:22 +00:00
import React from "react";
import { FormattedMessage } from "react-intl";
2019-06-19 14:40:52 +00:00
import Skeleton from "@saleor/components/Skeleton";
2019-10-30 14:34:24 +00:00
const useStyles = makeStyles(theme => ({
headerContainer: {
marginBottom: theme.spacing(3)
},
pageHeader: {
fontWeight: 600 as 600
},
subtitle: {
color: theme.typography.caption.color
}
}));
2019-06-19 14:40:52 +00:00
2019-10-30 14:34:24 +00:00
interface HomeOrdersCardProps {
2019-06-19 14:40:52 +00:00
userName: string;
}
2019-10-30 14:34:24 +00:00
const HomeOrdersCard: React.FC<HomeOrdersCardProps> = props => {
const { userName } = props;
const classes = useStyles(props);
return (
2019-08-09 11:14:35 +00:00
<div className={classes.headerContainer} data-tc="home-header">
<Typography className={classes.pageHeader} variant="h4">
{userName ? (
<FormattedMessage
defaultMessage="Hello there, {userName}"
description="header"
id="homeHeaderText"
values={{
userName
}}
/>
2019-08-09 11:14:35 +00:00
) : (
<Skeleton style={{ width: "10em" }} />
)}
</Typography>
<Typography className={classes.subtitle}>
{userName ? (
<FormattedMessage
defaultMessage="Here is some information we gathered about your store"
description="subheader"
id="homeHeaderTextCaption"
/>
2019-08-09 11:14:35 +00:00
) : (
<Skeleton style={{ width: "10em" }} />
)}
</Typography>
</div>
2019-10-30 14:34:24 +00:00
);
};
2019-06-19 14:40:52 +00:00
HomeOrdersCard.displayName = "HomeOrdersCard";
export default HomeOrdersCard;