Skip to content

Upgrades for Next 12 / MUI 5 #104

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

Open
wants to merge 44 commits into
base: commercial
Choose a base branch
from
Open
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
a46fe2f
Bump ini from 1.3.5 to 1.3.8 (#81)
dependabot[bot] Jan 4, 2021
4a260d5
fix build issues (#89)
artsiomyemelyanenka Apr 14, 2021
c9d2ba1
Bump elliptic from 6.5.3 to 6.5.4 (#86)
dependabot[bot] Apr 14, 2021
8e70b3b
Hardcoded working @material-ui/lab version
dijs Aug 18, 2021
097aafe
MUI 4.x -> 5.x
Dec 2, 2021
8c7543c
MUI preset-safe codemod
Dec 2, 2021
548e55e
import nit upd
Dec 2, 2021
44eb1ce
Migrate from JSS (codemod npx @mui/codemod v5.0.0/jss-to-styled)
Dec 2, 2021
9e7e1b4
proper theming
Dec 2, 2021
c617907
Merge pull request #2 from sudo97/master
cgbuen Dec 2, 2021
0007c17
Remove adaptV4Theme usage
cgbuen Dec 2, 2021
8ff143e
Add @mui/styles
cgbuen Dec 2, 2021
71812c7
ThemeProvider fix
Dec 3, 2021
4be3b2d
theme config
Dec 3, 2021
778ed87
Continue updating product/category usage
cgbuen Dec 4, 2021
bd8c88b
migrate to next.js 12, use SWC
Dec 7, 2021
6272166
linter
Dec 9, 2021
bbbdf0c
Bump ini from 1.3.5 to 1.3.8 (#81)
dependabot[bot] Jan 4, 2021
aa71a6b
Bump elliptic from 6.5.3 to 6.5.4 (#86)
dependabot[bot] Apr 14, 2021
7f463b1
MUI 4.x -> 5.x
Dec 2, 2021
2f88775
MUI preset-safe codemod
Dec 2, 2021
22f20b4
import nit upd
Dec 2, 2021
6033c3c
Migrate from JSS (codemod npx @mui/codemod v5.0.0/jss-to-styled)
Dec 2, 2021
b43ec05
proper theming
Dec 2, 2021
ad7c387
Remove adaptV4Theme usage
cgbuen Dec 2, 2021
2707205
Add @mui/styles
cgbuen Dec 2, 2021
e4ec4fc
ThemeProvider fix
Dec 3, 2021
8edcfba
theme config
Dec 3, 2021
8cd3f5b
Continue updating product/category usage
cgbuen Dec 4, 2021
7eadd0e
migrate to next.js 12, use SWC
Dec 7, 2021
c9b882b
linter
Dec 9, 2021
4fdd172
Merge branch 'upgrades-next-mui' of https://github.com/storefront-fou…
Dec 9, 2021
9ada097
minor fixes
Dec 9, 2021
6ec06cd
lint before commit
Dec 9, 2021
9cd1724
nit
Dec 10, 2021
39a8476
yalc clear
Dec 10, 2021
b461fe6
server syde styles upd
Dec 13, 2021
131b9c3
cleanup
Dec 15, 2021
9b45d48
@emotion/server dep
Dec 15, 2021
43df027
getServerSideProps for pages, and other fixes
Dec 15, 2021
eacf58a
Update package-lock
cgbuen Dec 15, 2021
08add68
Update package-lock for npm8 / legacy peer deps
cgbuen Dec 20, 2021
92cf199
Update references to fix errors
cgbuen Dec 20, 2021
7dc3bb3
Adjustment to NavBar component to play more nicely with MUI updates.
andersonbrandon Jan 11, 2022
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
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 13,
sourceType: 'module',
},
plugins: ['react'],
rules: {
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'react/display-name': 'off',
'react/prop-types': [2, { ignore: ['children'] }],
indent: ['error', 2, { offsetTernaryExpressions: true }],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'never'],
},
}
File renamed without changes.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.14.0
v14.14.0
52 changes: 34 additions & 18 deletions components/Header.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
import React, { useState, useCallback, useContext } from 'react'
import { makeStyles } from '@material-ui/core/styles'
import AppBar from 'react-storefront-amp/AmpAppBar'
import React, { useState, useCallback } from 'react'
import { styled } from '@mui/material/styles'
import AppBar from 'react-storefront/AppBar'
import CartButton from 'react-storefront/CartButton'
import Search from './search/Search'
import Logo from '../components/assets/react-storefront-logo.svg'
import { Container } from '@material-ui/core'
import Menu from 'react-storefront-amp/menu/AmpMenu'
import { Container } from '@mui/material'
import Menu from 'react-storefront/menu/Menu'
import MenuButton from 'react-storefront/menu/MenuButton'
import Link from 'react-storefront/link/Link'
import SessionContext from 'react-storefront/session/SessionContext'
import useCartTotal from 'react-storefront/hooks/useCartTotal'
import LazyHydrate from 'react-storefront/LazyHydrate'
import PropTypes from 'prop-types'

const useStyles = makeStyles(theme => ({
title: {},
logo: {
const PREFIX = 'Header'

const classes = {
title: `${PREFIX}-title`,
logo: `${PREFIX}-logo`,
toolbar: `${PREFIX}-toolbar`,
container: `${PREFIX}-container`,
accountLink: `${PREFIX}-accountLink`,
}

// TODO jss-to-styled codemod: The Fragment root was replaced by div. Change the tag if needed.
const Root = styled('div')(({ theme }) => ({
[`& .${classes.title}`]: {},

[`& .${classes.logo}`]: {
position: 'absolute',
left: 10,
top: 0,
[theme.breakpoints.down('xs')]: {
[theme.breakpoints.down('sm')]: {
left: '50%',
top: 6,
marginLeft: -60,
},
},
toolbar: {

[`& .${classes.toolbar}`]: {
padding: 0,
margin: 0,
},
container: {

[`& .${classes.container}`]: {
display: 'flex',
alignItems: 'center',
position: 'relative',

[theme.breakpoints.down('xs')]: {
[theme.breakpoints.down('sm')]: {
padding: 5,
},
},
accountLink: {
[`& .${classes.accountLink}`]: {
display: 'block',
color: '#000',
textTransform: 'uppercase',
Expand All @@ -46,19 +60,17 @@ const useStyles = makeStyles(theme => ({
}))

export default function Header({ menu }) {
const classes = useStyles()
const [menuOpen, setMenuOpen] = useState(false)
const [hydrateMenu, setHydrateMenu] = useState(false)
const handleMenuClose = useCallback(() => setMenuOpen(false), [])
const handleMenuButtonClick = useCallback(() => {
setMenuOpen(menuOpen => !menuOpen)
setHydrateMenu(true)
}, [])
const { session } = useContext(SessionContext)
const cartTotal = useCartTotal()

return (
<>
<Root>
<AppBar>
<Container maxWidth="lg" className={classes.container}>
<Link href="/">
Expand Down Expand Up @@ -96,6 +108,10 @@ export default function Header({ menu }) {
// renderFooter={item => <div>{item.text} footer</div>}
/>
</LazyHydrate>
</>
</Root>
)
}

Header.propTypes = {
menu: PropTypes.object,
}
24 changes: 17 additions & 7 deletions components/LandingCmsSlots.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import React from 'react'
import { makeStyles } from '@material-ui/core/styles'
import { styled } from '@mui/material/styles'
import CmsSlot from 'react-storefront/CmsSlot'
import PropTypes from 'prop-types'

const useStyles = makeStyles((/* theme */) => ({
cmsBlock: {
const PREFIX = 'LandingCmsSlots'

const classes = {
cmsBlock: `${PREFIX}-cmsBlock`,
}

// TODO jss-to-styled codemod: The Fragment root was replaced by div. Change the tag if needed.
const Root = styled('div')((/* theme */) => ({
[`& .${classes.cmsBlock}`]: {
'& img': {
maxWidth: '100vw',
},
Expand Down Expand Up @@ -110,17 +118,19 @@ const useStyles = makeStyles((/* theme */) => ({
}))

const LandingCmsSlots = ({ cmsBlocks }) => {
const classes = useStyles()

return (
<>
<Root>
{cmsBlocks.map(cmsBlock => (
<CmsSlot key={cmsBlock.identifier} className={classes.cmsBlock}>
{cmsBlock.content}
</CmsSlot>
))}
</>
</Root>
)
}

LandingCmsSlots.propTypes = {
cmsBlocks: PropTypes.array,
}

export default LandingCmsSlots
Loading