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][Button] Convert to support CSS extraction #41378

Merged
merged 26 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b484f4d
migrate button
siriwatknp Mar 5, 2024
8b8396c
Merge branch 'master' of https://github.com/mui/material-ui into pigm…
siriwatknp Mar 5, 2024
731e3b8
reexport keyframes from zero-styled
siriwatknp Mar 5, 2024
e8843e7
move default theme into a separate file
siriwatknp Mar 5, 2024
39efacc
migrate ButtonBase
siriwatknp Mar 6, 2024
3beb991
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Mar 22, 2024
7d980ac
revert lock file
siriwatknp Mar 22, 2024
194e6ce
generate demo pages
siriwatknp Mar 22, 2024
13e3ad7
revert defaultTheme
siriwatknp Mar 22, 2024
caa1b1a
adjust text and add dark styles
siriwatknp Mar 22, 2024
6b4bae0
remove enableCssLayer
siriwatknp Mar 22, 2024
305949a
fix boxShadow styles
siriwatknp Mar 22, 2024
6934bed
use is-prop-valid for string tag and add rootShouldForwardProp
siriwatknp Mar 22, 2024
985fb4e
fix lint
siriwatknp Mar 25, 2024
72891b7
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Mar 25, 2024
007dcb6
iterate palette
siriwatknp Mar 25, 2024
85dc9c6
fix fullWidth
siriwatknp Mar 25, 2024
1c7eec9
add @mui/lab as dependency to apps
siriwatknp Mar 25, 2024
8d5c677
fix inheritContained
siriwatknp Mar 25, 2024
1dd7263
use previous version
siriwatknp Mar 25, 2024
5a1a235
remove unnecessary directive
siriwatknp Mar 25, 2024
12426c5
use commonIconStyles
siriwatknp Mar 27, 2024
3af7b36
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp Mar 28, 2024
94d5ff2
revert lock file
siriwatknp Mar 28, 2024
ab3f25a
revert unnecesary change
siriwatknp Mar 28, 2024
ca447ca
pnpm install
siriwatknp Mar 28, 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
1 change: 1 addition & 0 deletions apps/pigment-css-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@pigment-css/react": "workspace:^",
"@mui/utils": "workspace:^",
"@mui/base": "workspace:^",
"@mui/lab": "workspace:^",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The demo contains LoadingButton from @mui/lab

"@mui/material": "workspace:^",
"@mui/system": "workspace:^",
"@mui/material-nextjs": "workspace:^",
Expand Down
10 changes: 8 additions & 2 deletions apps/pigment-css-next-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from 'next';
import { css } from '@pigment-css/react';
import { Inter } from 'next/font/google';
import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter';
import { ThemeProvider } from '@mui/material/styles';
Expand All @@ -18,8 +19,13 @@ export const metadata: Metadata = {
export default function RootLayout(props: { children: React.ReactNode }) {
return (
<html lang="en">
<body className={inter.className}>
<AppRouterCacheProvider options={{ enableCssLayer: true }}>
<body
className={`${inter.className} ${css`
background-color: ${({ theme: t }) => t.vars.palette.background.default};
color: ${({ theme: t }) => t.vars.palette.text.primary};
`}`}
>
<AppRouterCacheProvider>
<ThemeProvider theme={theme}>
<CssBaseline />
{props.children}
Expand Down
6 changes: 6 additions & 0 deletions apps/pigment-css-next-app/src/app/material-ui/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const Main = styled('div')(({ theme }) => ({
border: '1px solid rgb(229, 234, 242)',
borderRadius: '12px',
},
...theme.applyStyles('dark', {
'& .demo-container': {
backgroundColor: 'rgba(31, 38, 46, 0.1)',
border: '1px solid rgba(59, 74, 89, 0.2)',
},
}),
}));

export default function MaterialUILayout({ children }: { children: React.ReactNode }) {
Expand Down
121 changes: 121 additions & 0 deletions apps/pigment-css-next-app/src/app/material-ui/react-button/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
'use client';
import * as React from 'react';
import BasicButtons from '../../../../../../docs/data/material/components/buttons/BasicButtons';
import ButtonBaseDemo from '../../../../../../docs/data/material/components/buttons/ButtonBaseDemo';
import ButtonSizes from '../../../../../../docs/data/material/components/buttons/ButtonSizes';
import ColorButtons from '../../../../../../docs/data/material/components/buttons/ColorButtons';
import ContainedButtons from '../../../../../../docs/data/material/components/buttons/ContainedButtons';
import CustomizedButtons from '../../../../../../docs/data/material/components/buttons/CustomizedButtons';
import DisableElevation from '../../../../../../docs/data/material/components/buttons/DisableElevation';
import IconButtonColors from '../../../../../../docs/data/material/components/buttons/IconButtonColors';
import IconButtonSizes from '../../../../../../docs/data/material/components/buttons/IconButtonSizes';
import IconButtons from '../../../../../../docs/data/material/components/buttons/IconButtons';
import IconLabelButtons from '../../../../../../docs/data/material/components/buttons/IconLabelButtons';
import InputFileUpload from '../../../../../../docs/data/material/components/buttons/InputFileUpload';
import LoadingButtons from '../../../../../../docs/data/material/components/buttons/LoadingButtons';
import LoadingButtonsTransition from '../../../../../../docs/data/material/components/buttons/LoadingButtonsTransition';
import OutlinedButtons from '../../../../../../docs/data/material/components/buttons/OutlinedButtons';
import TextButtons from '../../../../../../docs/data/material/components/buttons/TextButtons';

export default function Buttons() {
return (
<React.Fragment>
<section>
<h2> Basic Buttons</h2>
<div className="demo-container">
<BasicButtons />
</div>
</section>
<section>
<h2> Button Base Demo</h2>
<div className="demo-container">
<ButtonBaseDemo />
</div>
</section>
<section>
<h2> Button Sizes</h2>
<div className="demo-container">
<ButtonSizes />
</div>
</section>
<section>
<h2> Color Buttons</h2>
<div className="demo-container">
<ColorButtons />
</div>
</section>
<section>
<h2> Contained Buttons</h2>
<div className="demo-container">
<ContainedButtons />
</div>
</section>
<section>
<h2> Customized Buttons</h2>
<div className="demo-container">
<CustomizedButtons />
</div>
</section>
<section>
<h2> Disable Elevation</h2>
<div className="demo-container">
<DisableElevation />
</div>
</section>
<section>
<h2> Icon Button Colors</h2>
<div className="demo-container">
<IconButtonColors />
</div>
</section>
<section>
<h2> Icon Button Sizes</h2>
<div className="demo-container">
<IconButtonSizes />
</div>
</section>
<section>
<h2> Icon Buttons</h2>
<div className="demo-container">
<IconButtons />
</div>
</section>
<section>
<h2> Icon Label Buttons</h2>
<div className="demo-container">
<IconLabelButtons />
</div>
</section>
<section>
<h2> Input File Upload</h2>
<div className="demo-container">
<InputFileUpload />
</div>
</section>
<section>
<h2> Loading Buttons</h2>
<div className="demo-container">
<LoadingButtons />
</div>
</section>
<section>
<h2> Loading Buttons Transition</h2>
<div className="demo-container">
<LoadingButtonsTransition />
</div>
</section>
<section>
<h2> Outlined Buttons</h2>
<div className="demo-container">
<OutlinedButtons />
</div>
</section>
<section>
<h2> Text Buttons</h2>
<div className="demo-container">
<TextButtons />
</div>
</section>
</React.Fragment>
);
}
1 change: 1 addition & 0 deletions apps/pigment-css-vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@pigment-css/react": "workspace:^",
"@mui/utils": "workspace:^",
"@mui/base": "workspace:^",
"@mui/lab": "workspace:^",
"@mui/material": "workspace:^",
"@mui/system": "workspace:^",
"@mui/icons-material": "workspace:^",
Expand Down
122 changes: 122 additions & 0 deletions apps/pigment-css-vite-app/src/pages/material-ui/react-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import * as React from 'react';
import MaterialUILayout from '../../Layout';
import BasicButtons from '../../../../../docs/data/material/components/buttons/BasicButtons.tsx';
import ButtonBaseDemo from '../../../../../docs/data/material/components/buttons/ButtonBaseDemo.tsx';
import ButtonSizes from '../../../../../docs/data/material/components/buttons/ButtonSizes.tsx';
import ColorButtons from '../../../../../docs/data/material/components/buttons/ColorButtons.tsx';
import ContainedButtons from '../../../../../docs/data/material/components/buttons/ContainedButtons.tsx';
import CustomizedButtons from '../../../../../docs/data/material/components/buttons/CustomizedButtons.tsx';
import DisableElevation from '../../../../../docs/data/material/components/buttons/DisableElevation.tsx';
import IconButtonColors from '../../../../../docs/data/material/components/buttons/IconButtonColors.tsx';
import IconButtonSizes from '../../../../../docs/data/material/components/buttons/IconButtonSizes.tsx';
import IconButtons from '../../../../../docs/data/material/components/buttons/IconButtons.tsx';
import IconLabelButtons from '../../../../../docs/data/material/components/buttons/IconLabelButtons.tsx';
import InputFileUpload from '../../../../../docs/data/material/components/buttons/InputFileUpload.tsx';
import LoadingButtons from '../../../../../docs/data/material/components/buttons/LoadingButtons.tsx';
import LoadingButtonsTransition from '../../../../../docs/data/material/components/buttons/LoadingButtonsTransition.tsx';
import OutlinedButtons from '../../../../../docs/data/material/components/buttons/OutlinedButtons.tsx';
import TextButtons from '../../../../../docs/data/material/components/buttons/TextButtons.tsx';

export default function Buttons() {
return (
<MaterialUILayout>
<h1>Buttons</h1>
<section>
<h2> Basic Buttons</h2>
<div className="demo-container">
<BasicButtons />
</div>
</section>
<section>
<h2> Button Base Demo</h2>
<div className="demo-container">
<ButtonBaseDemo />
</div>
</section>
<section>
<h2> Button Sizes</h2>
<div className="demo-container">
<ButtonSizes />
</div>
</section>
<section>
<h2> Color Buttons</h2>
<div className="demo-container">
<ColorButtons />
</div>
</section>
<section>
<h2> Contained Buttons</h2>
<div className="demo-container">
<ContainedButtons />
</div>
</section>
<section>
<h2> Customized Buttons</h2>
<div className="demo-container">
<CustomizedButtons />
</div>
</section>
<section>
<h2> Disable Elevation</h2>
<div className="demo-container">
<DisableElevation />
</div>
</section>
<section>
<h2> Icon Button Colors</h2>
<div className="demo-container">
<IconButtonColors />
</div>
</section>
<section>
<h2> Icon Button Sizes</h2>
<div className="demo-container">
<IconButtonSizes />
</div>
</section>
<section>
<h2> Icon Buttons</h2>
<div className="demo-container">
<IconButtons />
</div>
</section>
<section>
<h2> Icon Label Buttons</h2>
<div className="demo-container">
<IconLabelButtons />
</div>
</section>
<section>
<h2> Input File Upload</h2>
<div className="demo-container">
<InputFileUpload />
</div>
</section>
<section>
<h2> Loading Buttons</h2>
<div className="demo-container">
<LoadingButtons />
</div>
</section>
<section>
<h2> Loading Buttons Transition</h2>
<div className="demo-container">
<LoadingButtonsTransition />
</div>
</section>
<section>
<h2> Outlined Buttons</h2>
<div className="demo-container">
<OutlinedButtons />
</div>
</section>
<section>
<h2> Text Buttons</h2>
<div className="demo-container">
<TextButtons />
</div>
</section>
</MaterialUILayout>
);
}
Loading
Loading