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

feat: Add mui V5 support #77

Merged
merged 3 commits into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/coverage
/e2e-tests/**/public/
/examples/**/public/
www/public

/packages/**/lib/

Expand Down
20 changes: 0 additions & 20 deletions .github/stale.yml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.13.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.3",
"@mui/material": "^5.0.3",
"gatsby": "^3.2.1",
"gatsby-theme-material-ui": "^4.13.0",
"react": "^17.0.2",
Expand Down
22 changes: 6 additions & 16 deletions examples/simple/src/components/pro-tip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { makeStyles, SvgIcon, Typography } from '@material-ui/core';
import SvgIcon from '@mui/material/SvgIcon';
import Typography from '@mui/material/Typography';

function LightBulbIcon(props) {
return (
Expand All @@ -10,24 +11,13 @@ function LightBulbIcon(props) {
);
}

const useStyles = makeStyles((theme) => ({
root: {
margin: theme.spacing(6, 0, 3),
},
lightBulb: {
verticalAlign: `middle`,
marginRight: theme.spacing(1),
},
}));

export default function ProTip() {
const classes = useStyles();
return (
<Typography className={classes.root} color="textSecondary">
<LightBulbIcon className={classes.lightBulb} />
<Typography sx={{ mt: 6, mb: 3 }} color="text.secondary">
<LightBulbIcon sx={{ mr: 1, verticalAlign: `middle` }} />
Pro tip: See more{` `}
<Link href="https://next.material-ui.com/getting-started/page-layout-examples/">
page layout examples
<Link href="https://material-ui.com/getting-started/templates/">
templates
</Link>
{` `}
on the Material-UI documentation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTheme, colors } from '@material-ui/core';
import { createTheme, colors } from '@mui/material';

// A custom theme for this app
const theme = createTheme({
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Container, Box, Typography } from '@material-ui/core';
import { Container, Box, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';

Expand Down
2 changes: 1 addition & 1 deletion examples/simple/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Container, Box, Typography } from '@material-ui/core';
import { Container, Box, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';

Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.13.0",
"private": true,
"dependencies": {
"@material-ui/core": "4.12.3",
"@mui/material": "^5.0.3",
"gatsby": "^3.2.1",
"gatsby-plugin-typescript": "^3.2.0",
"gatsby-theme-material-ui": "^4.13.0",
Expand Down
26 changes: 6 additions & 20 deletions examples/typescript/src/components/pro-tip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon';
import Typography from '@material-ui/core/Typography';
import { Link } from 'gatsby-theme-material-ui';
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
import Typography from '@mui/material/Typography';

function LightBulbIcon(props: SvgIconProps) {
return (
Expand All @@ -12,26 +11,13 @@ function LightBulbIcon(props: SvgIconProps) {
);
}

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
margin: theme.spacing(6, 0, 3),
},
lightBulb: {
verticalAlign: `middle`,
marginRight: theme.spacing(1),
},
}),
);

export default function ProTip() {
const classes = useStyles();
return (
<Typography className={classes.root} color="textSecondary">
<LightBulbIcon className={classes.lightBulb} />
<Typography sx={{ mt: 6, mb: 3 }} color="text.secondary">
<LightBulbIcon sx={{ mr: 1, verticalAlign: `middle` }} />
Pro tip: See more{` `}
<Link href="https://next.material-ui.com/getting-started/page-layout-examples/">
page layout examples
<Link href="https://material-ui.com/getting-started/templates/">
templates
</Link>
{` `}
on the Material-UI documentation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import red from '@material-ui/core/colors/red';
import { createTheme } from '@material-ui/core';
import red from '@mui/material/colors/red';
import { createTheme } from '@mui/material';

// A custom theme for this app
const theme = createTheme({
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Container, Box, Typography } from '@material-ui/core';
import { Container, Box, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';

Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Container, Box, Typography } from '@material-ui/core';
import { Container, Box, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';

Expand Down
2 changes: 1 addition & 1 deletion examples/using-redux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.13.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.3",
"@mui/material": "^5.0.3",
"gatsby": "^3.2.1",
"gatsby-theme-material-ui": "^4.13.0",
"react": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/using-redux/src/components/counter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { Box, Button, Typography } from '@material-ui/core';
import { Box, Button, Typography } from '@mui/material';

function Counter({ count, increment }) {
return (
Expand Down
22 changes: 6 additions & 16 deletions examples/using-redux/src/components/pro-tip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { makeStyles, SvgIcon, Typography } from '@material-ui/core';
import SvgIcon from '@mui/material/SvgIcon';
import Typography from '@mui/material/Typography';

function LightBulbIcon(props) {
return (
Expand All @@ -10,24 +11,13 @@ function LightBulbIcon(props) {
);
}

const useStyles = makeStyles((theme) => ({
root: {
margin: theme.spacing(6, 0, 3),
},
lightBulb: {
verticalAlign: `middle`,
marginRight: theme.spacing(1),
},
}));

export default function ProTip() {
const classes = useStyles();
return (
<Typography className={classes.root} color="textSecondary">
<LightBulbIcon className={classes.lightBulb} />
<Typography sx={{ mt: 6, mb: 3 }} color="text.secondary">
<LightBulbIcon sx={{ mr: 1, verticalAlign: `middle` }} />
Pro tip: See more{` `}
<Link href="https://next.material-ui.com/getting-started/page-layout-examples/">
page layout examples
<Link href="https://material-ui.com/getting-started/templates/">
templates
</Link>
{` `}
on the Material-UI documentation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTheme, colors } from '@material-ui/core';
import { createTheme, colors } from '@mui/material';

// A custom theme for this app
const theme = createTheme({
Expand Down
2 changes: 1 addition & 1 deletion examples/using-redux/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Box, Container, Typography } from '@material-ui/core';
import { Box, Container, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';

Expand Down
2 changes: 1 addition & 1 deletion examples/using-redux/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'gatsby-theme-material-ui';
import { Box, Container, Typography } from '@material-ui/core';
import { Box, Container, Typography } from '@mui/material';

import ProTip from '../components/pro-tip';
import Counter from '../components/counter';
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
"start:simple": "yarn workspace example-simple start",
"start:typescript": "yarn workspace example-typescript start",
"start:using-redux": "yarn workspace example-using-redux start",
"start:www": "yarn workspace www start",
"build:simple": "yarn workspace example-simple build",
"build:typescript": "yarn workspace example-typescript build",
"build:using-redux": "yarn workspace example-using-redux build",
"build:www": "yarn workspace www build",
"prepare": "lerna run prepare",
"outdated:all": "yarn outdated",
"upgrade:all": "yarn upgrade-interactive --latest",
Expand All @@ -20,8 +18,7 @@
},
"workspaces": [
"packages/*",
"examples/*",
"www"
"examples/*"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.21.0",
Expand All @@ -38,6 +35,5 @@
"eslint-plugin-react-hooks": "^4.2.0",
"lerna": "^4.0.0",
"prettier": "^2.2.1"
},
"dependencies": {}
}
}
6 changes: 3 additions & 3 deletions packages/gatsby-material-ui-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ The components are part of the [gatsby-theme-material-ui](https://github.com/hup

```sh
// with npm
npm install gatsby-material-ui-components @material-ui/core
npm install gatsby-material-ui-components @mui/material

// with yarn
yarn add gatsby-material-ui-components @material-ui/core
yarn add gatsby-material-ui-components @mui/material
```

## How to use

```javascript
import React from "react";
import { Typography } from "@material-ui/core";
import { Typography } from "@mui/material";
//import { Link } from "gatsby"
import { Link } from "gatsby-material-ui-components";

Expand Down
8 changes: 6 additions & 2 deletions packages/gatsby-material-ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@
"prepare": "npm run build"
},
"peerDependencies": {
"@material-ui/core": ">=4.0.0",
"@mui/material": ">5.0.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"gatsby": "^3.0.0",
"react": ">=16.8.6 || >=17.0.0"
},
"devDependencies": {
"@material-ui/core": "4.12.3",
"@mui/material": "^5.0.3",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@testing-library/react": "^11.2.6",
"@testing-library/react-hooks": "^5.1.1",
"@types/jest": "^26.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
exports[`button button with ref 1`] = `
<DocumentFragment>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-text"
class="MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButtonBase-root css-1e6y48t-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-label"
/>
<span
class="MuiTouchRipple-root"
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</DocumentFragment>
Expand All @@ -20,17 +17,12 @@ exports[`button button with ref 1`] = `
exports[`button lbutton with to 1`] = `
<DocumentFragment>
<a
aria-disabled="false"
class="MuiButtonBase-root MuiButton-root MuiButton-text"
class="MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButtonBase-root css-1e6y48t-MuiButtonBase-root-MuiButton-root"
href="/page2"
role="button"
tabindex="0"
>
<span
class="MuiButton-label"
/>
<span
class="MuiTouchRipple-root"
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</a>
</DocumentFragment>
Expand All @@ -39,15 +31,12 @@ exports[`button lbutton with to 1`] = `
exports[`button should be rendered correctly 1`] = `
<DocumentFragment>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-text"
class="MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium MuiButtonBase-root css-1e6y48t-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
<span
class="MuiButton-label"
/>
<span
class="MuiTouchRipple-root"
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</DocumentFragment>
Expand Down
Loading