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

[Part 1] Replace Mantine with MUI #8

Merged
merged 44 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
08791d1
Add @rjsf/mui to the project
pamella Jan 11, 2024
c0168dd
Use MUI's form instead of Mantine's
pamella Jan 11, 2024
5193321
Use MUI on tutorial basic components
pamella Jan 11, 2024
348633f
Use MUI on OpenAIKeyWarning
pamella Jan 11, 2024
a44e8ff
Use MUI on ExampleDocLink
pamella Jan 11, 2024
a422eb8
Remove unused component
pamella Jan 11, 2024
5a21121
Use MUI on mdx files
pamella Jan 12, 2024
5e2ea48
Add @mui/lab to the project
pamella Jan 12, 2024
5ddb75c
Use MUI on single field assistant page
pamella Jan 12, 2024
b4c81b4
Use MUI on multi field assistant page
pamella Jan 12, 2024
c56ebe6
Use MUI on gen with assistant page
pamella Jan 12, 2024
d0ddb39
Use MUI on gen legal page
pamella Jan 12, 2024
c080489
Create LoadingBackdrop component
pamella Jan 12, 2024
f619075
Update export
pamella Jan 12, 2024
6dd5cfb
Use MUI on gen checklist page
pamella Jan 12, 2024
86f276d
Use MUI on gen er page
pamella Jan 12, 2024
cfee6c2
Use MUI on gen exam page
pamella Jan 12, 2024
03db59a
Use MUI on gen generic page
pamella Jan 12, 2024
93d1ce7
Use MUI on welcome page
pamella Jan 12, 2024
84c4763
Use MUI on docs layout
pamella Jan 12, 2024
309fb10
Create MuiThemeWrapper
pamella Jan 12, 2024
da4b611
Use MUI on schema form demo
pamella Jan 13, 2024
8a0b79b
Remove no longer used file
pamella Jan 13, 2024
2cfefee
Use MUI on footer
pamella Jan 13, 2024
32a2743
Start using MuiThemeWrapper
pamella Jan 13, 2024
c34a121
Use MUI on header navbar
pamella Jan 13, 2024
e2b48c7
Add missing name prop
pamella Jan 13, 2024
d6a127e
Fix console warning
pamella Jan 13, 2024
8857b90
Fix drawer nav and footer styling
pamella Jan 15, 2024
895edb4
Fix autocomplete field management
pamella Jan 15, 2024
8ed33ed
Fix footer styling
pamella Jan 15, 2024
598c0cd
Migrate docs styles to use MUI instead of Mantine
pamella Jan 15, 2024
7cb1cba
Remove unused Mantine theme
pamella Jan 15, 2024
bc7af06
Update docs styling
pamella Jan 15, 2024
93e254b
Remove remaining mantine usage
pamella Jan 16, 2024
605f4a5
Remove mantine-related dependencies
pamella Jan 16, 2024
aa1bb98
Update eslint to highlight problematic imports from @mui packages
pamella Jan 16, 2024
e950f87
Add comment about known issue
pamella Jan 16, 2024
b23c420
Create MDXProviderWrapper to map MDX and MUI
pamella Jan 16, 2024
4a12d0f
Add TODO comment
pamella Jan 16, 2024
8d4318d
Add mui to optimizePackageImports
pamella Jan 16, 2024
d5219b4
Add mui to optimizePackageImports
pamella Jan 16, 2024
87bc3b5
Fix code highlights
fjsj Jan 16, 2024
9a15d16
Merge pull request #9 from vintasoftware/rjsf-mui-part2
fjsj Jan 16, 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
10 changes: 8 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
extends: ['plugin:prettier/recommended', 'mantine'],
extends: ['plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended'],
env: {
browser: true,
es2021: true,
},
plugins: ['react', 'testing-library'],
plugins: ['react', 'testing-library', '@typescript-eslint'],
overrides: [
{
files: ['**/?(*.)+(spec|test).[jt]s?(x)'],
Expand Down Expand Up @@ -53,5 +53,11 @@ module.exports = {
modifiers: ['unused'],
},
],
'no-restricted-imports': [
'error',
{
patterns: ['@mui/*/*/*'],
},
],
},
};
2 changes: 1 addition & 1 deletion docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const nextConfig = {
ignoreDuringBuilds: true,
},
experimental: {
optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
optimizePackageImports: ['@mui/material', '@mui/icons-material', '@mui/lab'],
mdxRs: false,
},
};
Expand Down
1,943 changes: 1,171 additions & 772 deletions docs/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
"dependencies": {
"@ai-form-toolkit/client": "file:../packages/client",
"@ai-form-toolkit/server": "file:../packages/server",
"@mantine/code-highlight": "^7.3.2",
"@mantine/core": "^7.3.2",
"@mantine/dates": "^7.3.2",
"@mantine/form": "^7.3.2",
"@mantine/hooks": "^7.3.2",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mdx-js/react": "^3.0.0",
"@mui/icons-material": "^5.15.4",
"@mui/lab": "^5.0.0-alpha.160",
"@mui/material": "^5.15.4",
"@next/bundle-analyzer": "^14.0.4",
"@next/mdx": "^14.0.4",
"@rjsf/core": "^5.15.1",
"@rjsf/mui": "^5.15.1",
"@rjsf/utils": "^5.15.1",
"@rjsf/validator-ajv6": "^5.15.1",
"@rjsf/validator-ajv8": "^5.15.1",
"@tabler/icons-react": "^2.44.0",
"@types/mdx": "^2.0.10",
Expand All @@ -30,6 +32,7 @@
"next": "14.0.4",
"openai": "^4.23.0",
"react": "18.2.0",
"react-code-blocks": "^0.1.5",
"react-dom": "18.2.0",
"rehype-image-size": "^1.0.0",
"rehype-img-size": "^1.0.1",
Expand All @@ -46,9 +49,6 @@
"@types/node": "^20.10.4",
"@types/react": "18.2.45",
"babel-loader": "^9.1.3",
"postcss": "^8.4.32",
"postcss-preset-mantine": "1.11.1",
"postcss-simple-vars": "^7.0.1",
"typescript": "5.3.3"
}
}
14 changes: 0 additions & 14 deletions docs/postcss.config.cjs

This file was deleted.

18 changes: 18 additions & 0 deletions docs/src/MDXProviderWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use client';

import { HTMLAttributes, ReactNode } from 'react';
import { MDXProvider } from '@mdx-js/react';
import { Typography } from '@mui/material';

const MDXProviderWrapper = ({ children }: { children: ReactNode }) => {
const components = {
h1: (props: HTMLAttributes<HTMLElement>) => <Typography component="h1" variant="h4" marginY={2} {...props} />,
h2: (props: HTMLAttributes<HTMLElement>) => <Typography component="h2" variant="h5" marginY={2} {...props} />,
h3: (props: HTMLAttributes<HTMLElement>) => <Typography component="h3" variant="h6" marginY={2} {...props} />,
p: (props: HTMLAttributes<HTMLElement>) => <Typography component="p" variant="body1" marginY={2} {...props} />,
};

return <MDXProvider components={components}>{children}</MDXProvider>;
};

export default MDXProviderWrapper;
36 changes: 36 additions & 0 deletions docs/src/MuiThemeWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use client';

import { ReactNode } from 'react';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { CssBaseline } from '@mui/material';

const MuiThemeWrapper = ({ children }: { children: ReactNode }) => {
const theme = createTheme({
components: {
MuiButton: {
styleOverrides: {
root: {
minWidth: 0, // Disable minimum width for buttons
textTransform: 'none', // Disable auto-capitalization of button text
},
},
},
MuiTab: {
styleOverrides: {
root: {
textTransform: 'none', // Disable auto-capitalization of tab text
},
},
},
},
});

return (
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
);
};

export default MuiThemeWrapper;
61 changes: 53 additions & 8 deletions docs/src/app/docs-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,67 @@
'use client';

import { ReactNode } from 'react';
import { Box, rem } from '@mantine/core';
import { Box } from '@mui/material';
import { GlobalStyles } from '@mui/system';
import { Theme } from '@mui/material/styles';

import Layout from '@/layout';

import './docs-styles.css';

type Props = {
children: ReactNode;
};

export default function DocsLayout({ children }: Props) {
const docsMarkdownStyles = (theme: Theme) => ({
figure: {
margin: 0,
},
pre: {
overflowX: 'auto',
borderRadius: theme.shape.borderRadius,
padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
},
'span[data-highlighted-line]': {
borderBottomColor: '#9333EA',
backgroundColor: '#6B21A880',
fontWeight: 700,
color: '#E9D5FF',
},
// TODO: Use CodeBlock component instead. Configure it on MDXProviderWrapper.
code: {
counterReset: 'line',
fontSize: '0.8125rem',
},
'code > [data-line]::before': {
counterIncrement: 'line',
content: 'counter(line)',
display: 'inline-block',
width: theme.spacing(1),
marginRight: theme.spacing(1.5),
textAlign: 'right',
color: 'gray',
},
'code[data-line-numbers-max-digits="2"] > [data-line]::before': {
width: theme.spacing(2),
},
'code[data-line-numbers-max-digits="3"] > [data-line]::before': {
width: theme.spacing(3),
},
img: {
width: '100%',
height: 'auto',
border: `2px solid ${theme.palette.grey[200]}`,
},
});

return (
<Layout>
<Box maw={600} mx="auto" pb={rem(30)} px={rem(20)}>
{children}
</Box>
</Layout>
<>
<GlobalStyles styles={docsMarkdownStyles} />
<Layout>
<Box maxWidth={600} mx="auto" paddingTop={1} paddingBottom={4} paddingX={2.5}>
{children}
</Box>
</Layout>
</>
);
}
63 changes: 0 additions & 63 deletions docs/src/app/docs-styles.css

This file was deleted.

Loading
Loading