Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui] Export Pigment CSS layout components #42693

Merged
merged 28 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3a23222
export pigment layout components
siriwatknp Jun 20, 2024
2f14862
reexport layout components
siriwatknp Jun 20, 2024
24ed402
poc with latest pigment
siriwatknp Jun 20, 2024
088e088
restore
siriwatknp Jun 24, 2024
8ab5f8a
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Jun 24, 2024
c8cb8fb
[docs-infra] support mulitple entrypoints
siriwatknp Jun 24, 2024
2bf53cf
run docs:api
siriwatknp Jun 24, 2024
79b5dd2
update pigment to latest
siriwatknp Jun 24, 2024
9a5882f
add PigmentGrid
siriwatknp Jun 24, 2024
fe622f5
add layout component demo pages
siriwatknp Jun 24, 2024
865e815
ignore PigmentContainer, PigmentGrid, and PigmentStack
siriwatknp Jun 24, 2024
646a3c3
test windows fix
siriwatknp Jun 25, 2024
9bc2fad
add classes
siriwatknp Jun 25, 2024
050ac80
add specs
siriwatknp Jun 25, 2024
7ef300d
run docs:api
siriwatknp Jun 25, 2024
9e75c6a
add 'grow' to grid size
siriwatknp Jun 25, 2024
f8d6b16
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Jun 25, 2024
3d4a775
Revert "test windows fix"
siriwatknp Jun 25, 2024
2053947
update to latest pigment css
siriwatknp Jun 25, 2024
8b7be98
link PigmentGrid API to Grid2
siriwatknp Jun 25, 2024
661b5d4
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Jun 26, 2024
ac919fa
add useDefaultProps
siriwatknp Jun 26, 2024
823aae0
remove use client from demo pages
siriwatknp Jun 26, 2024
5c828bc
fix
siriwatknp Jun 26, 2024
362e233
Revert "add useDefaultProps"
siriwatknp Jun 26, 2024
6cd978a
ignore Pigment layout components
siriwatknp Jun 26, 2024
146f943
remove useDefaultProps from PigmentGrid
siriwatknp Jun 26, 2024
e66f40d
run proptypes and docs:api
siriwatknp Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/local-ui-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "0.0.1",
"private": true,
"dependencies": {
"@pigment-css/react": "^0.0.13"
"@pigment-css/react": "^0.0.15"
}
}
4 changes: 2 additions & 2 deletions apps/pigment-css-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "rimraf .next"
},
"dependencies": {
"@pigment-css/react": "^0.0.13",
"@pigment-css/react": "^0.0.15",
"@mui/utils": "workspace:^",
"@mui/base": "workspace:^",
"@mui/lab": "workspace:^",
Expand All @@ -24,7 +24,7 @@
"next": "latest"
},
"devDependencies": {
"@pigment-css/nextjs-plugin": "^0.0.14",
"@pigment-css/nextjs-plugin": "^0.0.15",
"@types/node": "^20.5.7",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use client';
siriwatknp marked this conversation as resolved.
Show resolved Hide resolved
import * as React from 'react';
import Box from '@mui/material/Box';
import Container from '@mui/material/PigmentContainer';

export default function ContainerPage() {
return (
<React.Fragment>
<section>
<h2> Fixed Container</h2>
<div className="demo-container">
<Container fixed>
<Box sx={{ bgcolor: '#cfe8fc', height: '30vh' }} />
</Container>
</div>
</section>
<section>
<h2> Simple Container</h2>
<div className="demo-container">
<Container maxWidth="sm">
<Box sx={{ bgcolor: '#cfe8fc', height: '30vh' }} />
</Container>
</div>
</section>
</React.Fragment>
);
}
74 changes: 74 additions & 0 deletions apps/pigment-css-next-app/src/app/material-ui/react-grid/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
'use client';
import * as React from 'react';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/PigmentGrid';
import { styled } from '@pigment-css/react';

const Item = styled(Paper)(({ theme }) => ({
backgroundColor: '#fff',
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: 'center',
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
backgroundColor: '#1A2027',
}),
}));

export default function GridPage() {
return (
<React.Fragment>
<section>
<h2> Basic Grid</h2>
<div className="demo-container">
<Box sx={{ flexGrow: 1 }}>
<Grid container spacing={2}>
<Grid size={{ xs: 8 }}>
<Item>xs=8</Item>
</Grid>
<Grid size={{ xs: 4 }}>
<Item>xs=4</Item>
</Grid>
<Grid size={{ xs: 4 }}>
<Item>xs=4</Item>
</Grid>
<Grid size={{ xs: 8 }}>
<Item>xs=8</Item>
</Grid>
</Grid>
</Box>
</div>
</section>
<section>
<h2> Columns Grid</h2>
<div className="demo-container">
<Box sx={{ flexGrow: 1 }}>
<Grid container spacing={2} columns={16}>
<Grid size={{ xs: 8 }}>
<Item>xs=8</Item>
</Grid>
<Grid size={{ xs: 8 }}>
<Item>xs=8</Item>
</Grid>
</Grid>
</Box>
</div>
</section>
<section>
<h2> Responsive Grid</h2>
<div className="demo-container">
<Box sx={{ flexGrow: 1 }}>
<Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}>
{Array.from(Array(6)).map((_, index) => (
<Grid size={{ xs: 2, sm: 4, md: 4, lg: 3 }} key={index}>
<Item>xs=2</Item>
</Grid>
))}
</Grid>
</Box>
</div>
</section>
</React.Fragment>
);
}
54 changes: 54 additions & 0 deletions apps/pigment-css-next-app/src/app/material-ui/react-stack/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use client';
import * as React from 'react';
import Divider from '@mui/material/Divider';
import Paper from '@mui/material/Paper';
import Stack from '@mui/material/PigmentStack';
import { styled } from '@pigment-css/react';

const Item = styled(Paper)(({ theme }) => ({
backgroundColor: '#fff',
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: 'center',
color: theme.palette.text.secondary,
...theme.applyStyles('dark', {
backgroundColor: '#1A2027',
}),
}));

export default function StackPage() {
return (
<React.Fragment>
<section>
<h2> Basic Stack</h2>
<div className="demo-container">
<Stack spacing={2}>
<Item>Item 1</Item>
<Item>Item 2</Item>
<Item>Item 3</Item>
</Stack>
</div>
</section>
<section>
<h2> Divider Stack</h2>
<div className="demo-container">
<Stack direction="row" divider={<Divider orientation="vertical" flexItem />} spacing={2}>
<Item>Item 1</Item>
<Item>Item 2</Item>
<Item>Item 3</Item>
</Stack>
</div>
</section>
<section>
<h2> Responsive Stack</h2>
<div className="demo-container">
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={{ xs: 1, sm: 2, md: 4 }}>
<Item>Item 1</Item>
<Item>Item 2</Item>
<Item>Item 3</Item>
</Stack>
</div>
</section>
</React.Fragment>
);
}
172 changes: 92 additions & 80 deletions apps/pigment-css-next-app/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Image from 'next/image';
import { styled, css } from '@pigment-css/react';
import PigmentStack from '@mui/material/PigmentStack';
import PigmentContainer from '@mui/material/PigmentContainer';
import PigmentHidden from '@mui/material/PigmentHidden';
import styles from './page.module.css';

const visuallyHidden = css({
Expand Down Expand Up @@ -91,92 +94,101 @@ const Description = styled.div({

export default function Home() {
return (
<Main>
<div className={visuallyHidden}>I am invisible</div>
<Description>
<p>
Get started by editing&nbsp;
<code className={styles.code}>src/app/page.tsx</code>
</p>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener"
>
By{' '}
<PigmentHidden implementation="css" only="xs">
<PigmentContainer maxWidth="md">
<Main>
<PigmentStack spacing={2}>
<div>Test</div>
<div>Test</div>
<div>Test</div>
</PigmentStack>
<div className={visuallyHidden}>I am invisible</div>
<Description>
<p>
Get started by editing&nbsp;
<code className={styles.code}>src/app/page.tsx</code>
</p>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</Description>

<div className={styles.center}>
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</a>
</div>
</Description>

<div className={styles.center}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>
</div>

<div className={styles.grid}>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<div className={styles.grid}>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>Learn about Next.js in an interactive course with&nbsp;quizzes!</p>
</a>
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>Learn about Next.js in an interactive course with&nbsp;quizzes!</p>
</a>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>Explore the Next.js 13 playground.</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>Explore the Next.js 13 playground.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>Instantly deploy your Next.js site to a shareable URL with Vercel.</p>
</a>
</div>
</Main>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>Instantly deploy your Next.js site to a shareable URL with Vercel.</p>
</a>
</div>
</Main>
</PigmentContainer>
</PigmentHidden>
);
}
4 changes: 2 additions & 2 deletions apps/pigment-css-vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vite build"
},
"dependencies": {
"@pigment-css/react": "^0.0.13",
"@pigment-css/react": "^0.0.15",
"@mui/utils": "workspace:^",
"@mui/base": "workspace:^",
"@mui/lab": "workspace:^",
Expand All @@ -27,7 +27,7 @@
"devDependencies": {
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@pigment-css/vite-plugin": "^0.0.13",
"@pigment-css/vite-plugin": "^0.0.15",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
Expand Down
Loading
Loading