forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[codemod] Fix jss-to-styled to support other export class, function e…
…tc. mui#28321
- Loading branch information
1 parent
c5215d1
commit 3c6c658
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/mui-codemod/src/v5.0.0/jss-to-styled.test/exportClass.actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
import withStyles from '@material-ui/styles/withStyles'; | ||
|
||
export class Bug {} | ||
|
||
const styles = { | ||
root: {}, | ||
}; | ||
|
||
const Test = withStyles(styles)(props => { | ||
const { classes } = props; | ||
return <div className={classes.root}>Anonymous</div>; | ||
}); | ||
|
||
export default Test |
20 changes: 20 additions & 0 deletions
20
packages/mui-codemod/src/v5.0.0/jss-to-styled.test/exportClass.expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@material-ui/core/styles'; | ||
const PREFIX = 'Test'; | ||
|
||
const classes = { | ||
root: `${PREFIX}-root` | ||
}; | ||
|
||
const Root = styled('div')({ | ||
[`&.${classes.root}`]: {}, | ||
}); | ||
|
||
export class Bug {} | ||
|
||
const Test = (props => { | ||
const { } = props; | ||
return <Root className={classes.root}>Anonymous</Root>; | ||
}); | ||
|
||
export default Test |
15 changes: 15 additions & 0 deletions
15
packages/mui-codemod/src/v5.0.0/jss-to-styled.test/exportFunction.actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
import withStyles from '@material-ui/styles/withStyles'; | ||
|
||
export function Bug() {} | ||
|
||
const styles = { | ||
root: {}, | ||
}; | ||
|
||
const Test = withStyles(styles)(props => { | ||
const { classes } = props; | ||
return <div className={classes.root}>Anonymous</div>; | ||
}); | ||
|
||
export default Test |
20 changes: 20 additions & 0 deletions
20
packages/mui-codemod/src/v5.0.0/jss-to-styled.test/exportFunction.expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@material-ui/core/styles'; | ||
const PREFIX = 'Test'; | ||
|
||
const classes = { | ||
root: `${PREFIX}-root` | ||
}; | ||
|
||
const Root = styled('div')({ | ||
[`&.${classes.root}`]: {}, | ||
}); | ||
|
||
export function Bug() {} | ||
|
||
const Test = (props => { | ||
const { } = props; | ||
return <Root className={classes.root}>Anonymous</Root>; | ||
}); | ||
|
||
export default Test |