Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 49x 49x 4x 2x 49x 49x 49x | import { alpha } from "@mui/material/styles";
import { Box, Typography } from "@mui/material";
function getGreeting() {
const h = new Date().getHours();
if (h < 12) return "Good morning";
if (h < 17) return "Good afternoon";
return "Good evening";
}
function formatDate() {
return new Date().toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric", year: "numeric" });
}
export default function WelcomeBanner({ firstName, isMobile }) {
return (
<Box
sx={{
background: (t) =>
`linear-gradient(135deg, ${t.palette.primary.dark} 0%, ${t.palette.primary.main} 60%, ${alpha(t.palette.primary.light, 0.9)} 100%)`,
px: { xs: 2.5, sm: 4, md: 5 },
pt: { xs: 3, sm: 4 },
pb: { xs: 5, sm: 6 },
color: "#fff",
position: "relative",
overflow: "hidden",
"&::after": {
content: '""',
position: "absolute",
bottom: -40,
right: -40,
width: 220,
height: 220,
borderRadius: "50%",
bgcolor: "rgba(255,255,255,0.05)",
},
"&::before": {
content: '""',
position: "absolute",
top: -60,
right: 80,
width: 160,
height: 160,
borderRadius: "50%",
bgcolor: "rgba(255,255,255,0.06)",
},
}}
>
<Typography
variant={isMobile ? "h5" : "h4"}
fontWeight={800}
sx={{ letterSpacing: "-0.01em", position: "relative" }}
>
{getGreeting()}
{firstName ? `, ${firstName}` : ""}! 👋
</Typography>
<Typography variant="body2" sx={{ mt: 0.5, opacity: 0.85, position: "relative" }}>
{formatDate()}
</Typography>
</Box>
);
}
|