|
| 1 | +import DefaultPropsProvider from "@mui/material/DefaultPropsProvider"; |
| 2 | +import CssBaseline from "@mui/material/CssBaseline"; |
| 3 | +import Container from "@mui/material-pigment-css/Container"; |
| 4 | +import Grid from "@mui/material-pigment-css/Grid"; |
| 5 | +import Stack from "@mui/material-pigment-css/Stack"; |
| 6 | +import Typography from "@mui/material/Typography"; |
| 7 | +import Chip from "@mui/material/Chip"; |
| 8 | +import { styled } from "@mui/material-pigment-css"; |
| 9 | + |
| 10 | +const Title = styled("div")(({ theme }) => ({ |
| 11 | + color: theme.vars.palette.text.primary, |
| 12 | + font: theme.vars.font.body1, |
| 13 | + fontSize: "1.125rem", |
| 14 | + lineHeight: 1.7, |
| 15 | +})); |
| 16 | + |
| 17 | +export default function Home() { |
| 18 | + return ( |
| 19 | + <main sx={{ minHeight: "100lvh", display: "grid", placeItems: "center" }}> |
| 20 | + <DefaultPropsProvider |
| 21 | + value={{ |
| 22 | + MuiChip: { |
| 23 | + label: "Available in v6", |
| 24 | + }, |
| 25 | + }} |
| 26 | + > |
| 27 | + <CssBaseline /> |
| 28 | + <Container> |
| 29 | + <Grid container spacing={{ xs: 2, sm: 3, md: 4 }}> |
| 30 | + <Grid size={{ xs: 12, md: 6 }} sx={{ pl: 4.5 }}> |
| 31 | + <Chip |
| 32 | + sx={(theme) => ({ |
| 33 | + mb: 2, |
| 34 | + fontWeight: 600, |
| 35 | + bgcolor: `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)`, |
| 36 | + color: "primary.dark", |
| 37 | + })} |
| 38 | + /> |
| 39 | + <Typography |
| 40 | + variant="h1" |
| 41 | + sx={{ |
| 42 | + fontWeight: 500, |
| 43 | + fontSize: "clamp(3rem, 2.354rem + 2.7562vw, 5rem)", |
| 44 | + textWrap: "balance", |
| 45 | + letterSpacing: "-0.025em", |
| 46 | + }} |
| 47 | + > |
| 48 | + <span |
| 49 | + sx={(theme) => ({ |
| 50 | + display: "block", |
| 51 | + background: `linear-gradient(145deg, ${ |
| 52 | + (theme.vars || theme).palette.primary.light |
| 53 | + } 5%, ${(theme.vars || theme).palette.primary.dark} 90%)`, |
| 54 | + // `Webkit` has to come later |
| 55 | + WebkitBackgroundClip: "text", |
| 56 | + WebkitTextFillColor: "transparent", |
| 57 | + })} |
| 58 | + > |
| 59 | + Material UI |
| 60 | + </span> |
| 61 | + Pigment CSS |
| 62 | + </Typography> |
| 63 | + </Grid> |
| 64 | + <Grid size={{ xs: 12, md: 6 }}> |
| 65 | + <Stack |
| 66 | + component="ul" |
| 67 | + spacing={3} |
| 68 | + sx={{ |
| 69 | + m: 0, |
| 70 | + pl: 3, |
| 71 | + color: "text.secondary", |
| 72 | + "& li": { |
| 73 | + pl: 2, |
| 74 | + fontSize: "1.125rem", |
| 75 | + fontWeight: 500, |
| 76 | + "&::marker": { |
| 77 | + color: "text.primary", |
| 78 | + }, |
| 79 | + }, |
| 80 | + }} |
| 81 | + > |
| 82 | + <li |
| 83 | + sx={{ |
| 84 | + "&::marker": { content: '"⚡️"' }, |
| 85 | + }} |
| 86 | + > |
| 87 | + <Title>Build-time CSS Extraction</Title> |
| 88 | + <Typography> |
| 89 | + Pigment CSS looks through Material UI components used in the |
| 90 | + project and extracts the styles into plain CSS. |
| 91 | + </Typography> |
| 92 | + </li> |
| 93 | + <li |
| 94 | + sx={{ |
| 95 | + "&::marker": { content: '"🚀"' }, |
| 96 | + }} |
| 97 | + > |
| 98 | + <Title>React Server Components</Title> |
| 99 | + <Typography> |
| 100 | + Material UI provides a set of layout components that |
| 101 | + integrates with Pigment CSS to support React Server |
| 102 | + Components. |
| 103 | + </Typography> |
| 104 | + </li> |
| 105 | + <li |
| 106 | + sx={{ |
| 107 | + "&::marker": { content: '"📦"' }, |
| 108 | + }} |
| 109 | + > |
| 110 | + <Title>Emotionless</Title> |
| 111 | + <Typography> |
| 112 | + Replacing Emotion with Pigment CSS eliminates ~15kB from the |
| 113 | + final bundle. |
| 114 | + </Typography> |
| 115 | + </li> |
| 116 | + </Stack> |
| 117 | + </Grid> |
| 118 | + </Grid> |
| 119 | + </Container> |
| 120 | + </DefaultPropsProvider> |
| 121 | + </main> |
| 122 | + ); |
| 123 | +} |
0 commit comments