@@ -12,23 +12,23 @@ import {
1212} from '@data-driven-forms/form-builder/dist/cjs/mui-builder-mappers' ;
1313import { makeStyles } from '@material-ui/styles' ;
1414import Box from '@material-ui/core/Box' ;
15- import Button from '@material-ui/core/Button'
16- import Snackbar from '@material-ui/core/Snackbar'
15+ import Button from '@material-ui/core/Button' ;
16+ import Snackbar from '@material-ui/core/Snackbar' ;
1717import IconButton from '@material-ui/core/IconButton' ;
1818import ExpansionPanel from '@material-ui/core/ExpansionPanel' ;
1919import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails' ;
2020import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary' ;
2121import Typography from '@material-ui/core/Typography' ;
22- import CloseIcon from '@material-ui/icons/Close'
22+ import CloseIcon from '@material-ui/icons/Close' ;
2323import PanToolIcon from '@material-ui/icons/PanTool' ;
2424
2525import dynamic from 'next/dynamic' ;
26+
27+ import PropTypes from 'prop-types' ;
2628const CodeEditor = dynamic ( import ( '../src/components/code-editor' ) , {
2729 ssr : false
2830} ) ;
2931
30-
31-
3232const useStyles = makeStyles ( ( theme ) => ( {
3333 builderWrapper : {
3434 width : '100%'
@@ -37,7 +37,7 @@ const useStyles = makeStyles((theme) => ({
3737 padding : theme . spacing ( 0.5 )
3838 } ,
3939 builderControlsWrapper : {
40- width : '100%' ,
40+ width : '100%'
4141 } ,
4242 builderButton : {
4343 '&:not(:last-child)' : {
@@ -50,21 +50,22 @@ const useStyles = makeStyles((theme) => ({
5050 emptyTarget : {
5151 height : '100%'
5252 }
53- } ) )
53+ } ) ) ;
5454
5555const EmptyTarget = ( ) => {
5656 const classes = useStyles ( ) ;
5757 return (
58- < Box display = "flex" justifyContent = "center" alignItems = "center" flexDirection = "column" className = { classes . emptyTarget } >
59- < Typography variant = "h3" gutterBottom >
60- There are no fields yet.
61- </ Typography >
62- < Typography variant = "h4" >
63- < PanToolIcon />
64- You can add fields by dragging from the menu on the left.
65- </ Typography >
66- </ Box >
67- ) }
58+ < Box display = "flex" justifyContent = "center" alignItems = "center" flexDirection = "column" className = { classes . emptyTarget } >
59+ < Typography variant = "h3" gutterBottom >
60+ There are no fields yet.
61+ </ Typography >
62+ < Typography variant = "h4" >
63+ < PanToolIcon />
64+ You can add fields by dragging from the menu on the left.
65+ </ Typography >
66+ </ Box >
67+ ) ;
68+ } ;
6869
6970const reducedMapper = {
7071 ...builderMapper ,
@@ -135,6 +136,11 @@ const CopySnackbar = ({ open, handleClose }) => {
135136 ) ;
136137} ;
137138
139+ CopySnackbar . propTypes = {
140+ open : PropTypes . bool ,
141+ handleClose : PropTypes . func
142+ } ;
143+
138144const LiveEditor = ( ) => {
139145 const classes = useStyles ( ) ;
140146 const [ openTooltip , setOpenTooltip ] = useState ( false ) ;
@@ -155,21 +161,21 @@ const LiveEditor = () => {
155161 debug = { false }
156162 render = { ( { isValid, getSchema, ...props } ) => (
157163 < BuilderTemplate { ...props } className = { classes . builderWrapper } >
158- < ExpansionPanel className = { classes . expansionPanel } >
159- < ExpansionPanelSummary >
160- < Box display = "flex" justifyContent = "space-between" alignItems = "center" className = { classes . builderControlsWrapper } >
161- < Typography > Click to preview schema</ Typography >
162- < CopyToClipboard text = { JSON . stringify ( getSchema ( ) ) } onCopy = { ( ) => setOpenTooltip ( true ) } >
163- < Button variant = "contained" color = "primary" className = { classes . builderButton } onClick = { event => event . stopPropagation ( ) } >
164- Copy schema
165- </ Button >
166- </ CopyToClipboard >
167- </ Box >
168- </ ExpansionPanelSummary >
169- < ExpansionPanelDetails >
170- < CodeEditor value = { JSON . stringify ( getSchema ( ) , null , 2 ) } />
171- </ ExpansionPanelDetails >
172- </ ExpansionPanel >
164+ < ExpansionPanel className = { classes . expansionPanel } >
165+ < ExpansionPanelSummary >
166+ < Box display = "flex" justifyContent = "space-between" alignItems = "center" className = { classes . builderControlsWrapper } >
167+ < Typography > Click to preview schema</ Typography >
168+ < CopyToClipboard text = { JSON . stringify ( getSchema ( ) ) } onCopy = { ( ) => setOpenTooltip ( true ) } >
169+ < Button variant = "contained" color = "primary" className = { classes . builderButton } onClick = { ( event ) => event . stopPropagation ( ) } >
170+ Copy schema
171+ </ Button >
172+ </ CopyToClipboard >
173+ </ Box >
174+ </ ExpansionPanelSummary >
175+ < ExpansionPanelDetails >
176+ < CodeEditor value = { JSON . stringify ( getSchema ( ) , null , 2 ) } />
177+ </ ExpansionPanelDetails >
178+ </ ExpansionPanel >
173179 < CopySnackbar open = { openTooltip } handleClose = { ( ) => setOpenTooltip ( false ) } />
174180 </ BuilderTemplate >
175181 ) }
0 commit comments