Skip to content

Commit

Permalink
Modify demo apps to use @mui/material-pigment-css
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed Jul 2, 2024
1 parent 5465942 commit 3e7b81a
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 35 deletions.
2 changes: 1 addition & 1 deletion apps/pigment-css-next-app/src/app/box/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable material-ui/no-empty-box */

import { styled } from '@pigment-css/react';
import { styled } from '@mui/material-pigment-css';
import * as React from 'react';
import { Box as MuiBox } from '../../components/Box';

Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-next-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter';
import { ThemeProvider } from '@mui/material/styles';
import '@pigment-css/react/styles.css';
import '@mui/material-pigment-css/styles.css';
import theme from './theme';

import './globals.css';
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-next-app/src/app/material-ui/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { styled } from '@pigment-css/react';
import { styled } from '@mui/material-pigment-css';

const Main = styled('div')(({ theme }) => ({
display: 'flex',
Expand Down
9 changes: 4 additions & 5 deletions apps/pigment-css-next-app/src/app/material-ui/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import * as React from 'react';
import Link from 'next/link';
import fs from 'fs/promises';
import path from 'path';
import { css } from '@pigment-css/react';
import Box from '@pigment-css/react/Box';
import { css } from '@mui/material-pigment-css';

export default async function MaterialUIPage() {
const rootPaths = await fs.readdir(path.join(process.cwd(), `src/app/material-ui`));
return (
<div>
<h1>Material UI Components</h1>
<nav>
<Box
as="ul"
<ul
// @ts-ignore
sx={{
margin: 0,
marginBlock: '1rem',
Expand All @@ -39,7 +38,7 @@ export default async function MaterialUIPage() {
</Link>
</li>
))}
</Box>
</ul>
</nav>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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';
import { styled } from '@mui/material-pigment-css';

const Item = styled(Paper)(({ theme }) => ({
backgroundColor: '#fff',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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';
import { styled } from '@mui/material-pigment-css';

const Item = styled(Paper)(({ theme }) => ({
backgroundColor: '#fff',
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-next-app/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Image from 'next/image';
import { styled, css } from '@pigment-css/react';
import { styled, css } from '@mui/material-pigment-css';
import PigmentStack from '@mui/material/PigmentStack';
import PigmentContainer from '@mui/material/PigmentContainer';
import PigmentHidden from '@mui/material/PigmentHidden';
Expand Down
4 changes: 2 additions & 2 deletions apps/pigment-css-next-app/src/augment.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ExtendTheme } from '@pigment-css/react';
import type { ExtendTheme } from '@mui/material-pigment-css';

declare module '@pigment-css/react/theme' {
declare module '@mui/material-pigment-css/theme' {
interface ThemeTokens {
'max-width': string;
'border-radius': string;
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-next-app/src/components/Box.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAtomics } from '@pigment-css/react';
import { generateAtomics } from '@mui/material-pigment-css';

const atomics = generateAtomics(({ theme }) => ({
conditions: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
Expand Down
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 @@ -10,6 +10,7 @@
},
"dependencies": {
"@pigment-css/react": "^0.0.16",
"@mui/material-pigment-css": "workspace:^",
"@mui/utils": "workspace:^",
"@mui/base": "workspace:^",
"@mui/lab": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-vite-app/src/Box.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAtomics } from '@pigment-css/react';
import { generateAtomics } from '@mui/material-pigment-css';

const atomics = generateAtomics(({ theme }) => ({
conditions: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-vite-app/src/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { styled } from '@pigment-css/react';
import { styled } from '@mui/material-pigment-css';

const Main = styled.main(({ theme }) => ({
display: 'flex',
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-vite-app/src/Slider/ZeroSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getSliderUtilityClass,
} from '@mui/material/Slider';
import { isHostComponent, useSlotProps } from '@mui/base/utils';
import { styled } from '@pigment-css/react';
import { styled } from '@mui/material-pigment-css';
import { capitalize } from '@mui/material/utils';
import { SliderValueLabel } from '@mui/material/Slider';
import { useSlider, valueToPercent } from '@mui/base/useSlider';
Expand Down
4 changes: 2 additions & 2 deletions apps/pigment-css-vite-app/src/augment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { extendTheme } from '@mui/material/styles';
import '@pigment-css/react/theme';
import '@mui/material-pigment-css';

declare module '@pigment-css/react/theme' {
declare module '@mui/material-pigment-css/theme' {
export interface ThemeArgs {
theme: ReturnType<typeof extendTheme> & {
applyDarkStyles<T>(obj: T): Record<string, T>;
Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-vite-app/src/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '@pigment-css/react';
import { styled } from '@mui/material-pigment-css';

export function Component() {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@pigment-css/react';
import { css } from '@mui/material-pigment-css';
import Alert from '@mui/material/Alert';
import { FallbackProps } from 'react-error-boundary';

Expand Down
2 changes: 1 addition & 1 deletion apps/pigment-css-vite-app/src/extend-zero.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { extendTheme } from '@mui/material/styles';

declare module '@pigment-css/react/theme' {
declare module '@mui/material-pigment-css/theme' {
interface ThemeArgs {
theme: ReturnType<typeof extendTheme> & {
applyDarkStyles<T>(obj: T): Record<string, T>;
Expand Down
10 changes: 4 additions & 6 deletions apps/pigment-css-vite-app/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { BrowserRouter as Router, useLocation, useRoutes } from 'react-router-do
import { ThemeProvider, createTheme } from '@mui/material/styles';
import CircularProgress from '@mui/material/CircularProgress';
import CssBaseline from '@mui/material/CssBaseline';
import { css } from '@pigment-css/react';
import Box from '@pigment-css/react/Box';
import { css } from '@mui/material-pigment-css';
import { ErrorBoundary } from 'react-error-boundary';
import routes from '~react-pages';
import '@pigment-css/react/styles.css';
import '@mui/material-pigment-css/styles.css';
import { ErrorBoundaryFallback } from './components/ErrorBoundaryFallback';

function App() {
Expand All @@ -17,8 +16,7 @@ function App() {
<ErrorBoundary key={location.pathname} FallbackComponent={ErrorBoundaryFallback}>
<React.Suspense
fallback={
<Box
as="div"
<div
className={css`
width: 100vw;
height: 100vh;
Expand All @@ -28,7 +26,7 @@ function App() {
`}
>
<CircularProgress size={100} variant="indeterminate" />
</Box>
</div>
}
>
{useRoutes(routes)}
Expand Down
12 changes: 5 additions & 7 deletions apps/pigment-css-vite-app/src/pages/material-ui/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { useLocation, matchRoutes, Link } from 'react-router-dom';
import Box from '@pigment-css/react/Box';
import routes from '~react-pages';
import Layout from '../../Layout';

Expand All @@ -17,8 +16,8 @@ export default function MaterialIndex() {
<div>
<h1>Material UI Components</h1>
<nav>
<Box
as="ul"
<ul
// @ts-ignore
sx={{
margin: 0,
marginBlock: '1rem',
Expand All @@ -33,19 +32,18 @@ export default function MaterialIndex() {
.filter((item) => !!item.path)
.map((item) => (
<li key={item.path}>
<Box
as={Link}
<Link
to={`/material-ui/${item.path}`}
sx={{
textDecoration: 'underline',
fontSize: '17px',
}}
>
{item.path}
</Box>
</Link>
</li>
))}
</Box>
</ul>
</nav>
</div>
</Layout>
Expand Down

0 comments on commit 3e7b81a

Please sign in to comment.