-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
6,346 additions
and
5,364 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,73 @@ | ||
import ComponentPanelItem from '../right/ComponentPanelItem'; | ||
import Grid from '@mui/material/Grid'; | ||
import React from 'react'; | ||
import { RootState } from '../../redux/store'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
const ComponentDrag = ({ isThemeLight }): JSX.Element => { | ||
const classes = useStyles(); | ||
const state = useSelector((store: RootState) => store.appState); | ||
|
||
const isFocus = (targetId: Number) => { | ||
return state.canvasFocus.componentId === targetId ? true : false; | ||
}; | ||
|
||
return ( | ||
<div className={classes.panelWrapper}> | ||
<div className={classes.panelWrapperList}> | ||
<h4 className={classes.darkThemeFontColor}> | ||
{state.projectType === 'Next.js' || state.projectType === 'Gatsby.js' | ||
? 'Pages' | ||
: 'Root Components'} | ||
</h4> | ||
<Grid | ||
container | ||
direction="row" | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
{state.components | ||
.filter((comp) => state.rootComponents.includes(comp.id)) | ||
.map((comp) => { | ||
return ( | ||
<ComponentPanelItem | ||
isFocus={isFocus(comp.id)} | ||
key={`comp-${comp.id}`} | ||
name={comp.name} | ||
id={comp.id} | ||
root={true} | ||
isThemeLight={isThemeLight} | ||
/> | ||
); | ||
})} | ||
</Grid> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
panelWrapper: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
flexGrow: 1, | ||
overflow: 'auto' | ||
}, | ||
panelWrapperList: { | ||
minHeight: '120px' | ||
}, | ||
lightThemeFontColor: { | ||
color: '#fff' | ||
}, | ||
darkThemeFontColor: { | ||
color: '#fff' | ||
} | ||
}); | ||
|
||
export default ComponentDrag; | ||
import React from 'react'; | ||
import Grid from '@mui/material/Grid'; | ||
import { RootState } from '../../redux/store'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import { useSelector } from 'react-redux'; | ||
import ComponentPanelItem from '../right/ComponentPanelItem'; | ||
|
||
|
||
const useStyles = makeStyles({ | ||
panelWrapper: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
flexGrow: 1, | ||
overflow: 'auto' | ||
}, | ||
panelWrapperList: { | ||
minHeight: 'auto' | ||
}, | ||
lightThemeFontColor: { | ||
color: '#fff' | ||
}, | ||
darkThemeFontColor: { | ||
color: '#fff' | ||
} | ||
}); | ||
|
||
const ComponentDrag = ({ isVisible, isThemeLight }): JSX.Element | null => { | ||
const classes = useStyles(); | ||
const state = useSelector((store: RootState) => store.appState); | ||
|
||
const isFocus = (targetId: Number) => { | ||
return state.canvasFocus.componentId === targetId ? true : false; | ||
}; | ||
|
||
if (!isVisible) return null; | ||
|
||
return ( | ||
<div className={classes.panelWrapper}> | ||
<div className={classes.panelWrapperList}> | ||
<h4 className={classes.darkThemeFontColor}> | ||
{state.projectType === 'Next.js' || state.projectType === 'Gatsby.js' | ||
? 'Pages' | ||
: ''} | ||
</h4> | ||
<Grid | ||
container | ||
direction="row" | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
{state.components | ||
.filter((comp) => state.rootComponents.includes(comp.id)) | ||
.map((comp) => { | ||
return ( | ||
<ComponentPanelItem | ||
isFocus={isFocus(comp.id)} | ||
key={`comp-${comp.id}`} | ||
name={comp.name} | ||
id={comp.id} | ||
root={true} | ||
isThemeLight={isThemeLight} | ||
/> | ||
); | ||
})} | ||
</Grid> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ComponentDrag; | ||
|
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 |
---|---|---|
@@ -1,61 +1,61 @@ | ||
import ComponentPanelItem from '../right/ComponentPanelItem'; | ||
import Grid from '@mui/material/Grid'; | ||
import React from 'react'; | ||
import { RootState } from '../../redux/store'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
const ComponentsContainer = () => { | ||
const classes = useStyles(); | ||
const state = useSelector((store: RootState) => store.appState); | ||
|
||
const isFocus = (targetId: Number) => { | ||
return state.canvasFocus.componentId === targetId ? true : false; | ||
}; | ||
return ( | ||
<div> | ||
<div className={classes.panelWrapper}> | ||
<div className={classes.panelWrapperList}> | ||
<h4 className={classes.darkThemeFontColor}>Reusable Components</h4> | ||
<Grid container direction="column" alignContent={'center'}> | ||
{state.components | ||
.filter((comp) => !state.rootComponents.includes(comp.id)) | ||
.map((comp) => { | ||
return ( | ||
<ComponentPanelItem | ||
isFocus={isFocus(comp.id)} | ||
key={`comp-${comp.id}`} | ||
name={comp.name} | ||
id={comp.id} | ||
root={false} | ||
isThemeLight={false} | ||
/> | ||
); | ||
})} | ||
</Grid> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
panelWrapper: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
flexGrow: 1, | ||
overflow: 'auto' | ||
}, | ||
panelWrapperList: { | ||
minHeight: '120px' | ||
}, | ||
lightThemeFontColor: { | ||
color: '#fff' | ||
}, | ||
darkThemeFontColor: { | ||
color: '#fff' | ||
} | ||
}); | ||
|
||
export default ComponentsContainer; | ||
import ComponentPanelItem from '../right/ComponentPanelItem'; | ||
import Grid from '@mui/material/Grid'; | ||
import React from 'react'; | ||
import { RootState } from '../../redux/store'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
const ComponentsContainer = () => { | ||
const classes = useStyles(); | ||
const state = useSelector((store: RootState) => store.appState); | ||
|
||
const isFocus = (targetId: Number) => { | ||
return state.canvasFocus.componentId === targetId ? true : false; | ||
}; | ||
return ( | ||
<div> | ||
<div className={classes.panelWrapper}> | ||
<div className={classes.panelWrapperList}> | ||
<h4 className={classes.darkThemeFontColor}>Reusable Components</h4> | ||
<Grid container direction="column" alignContent={'center'}> | ||
{state.components | ||
.filter((comp) => !state.rootComponents.includes(comp.id)) | ||
.map((comp) => { | ||
return ( | ||
<ComponentPanelItem | ||
isFocus={isFocus(comp.id)} | ||
key={`comp-${comp.id}`} | ||
name={comp.name} | ||
id={comp.id} | ||
root={false} | ||
isThemeLight={false} | ||
/> | ||
); | ||
})} | ||
</Grid> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
panelWrapper: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
flexGrow: 1, | ||
overflow: 'auto' | ||
}, | ||
panelWrapperList: { | ||
minHeight: 'auto' | ||
}, | ||
lightThemeFontColor: { | ||
color: '#fff' | ||
}, | ||
darkThemeFontColor: { | ||
color: '#fff' | ||
} | ||
}); | ||
|
||
export default ComponentsContainer; |
Oops, something went wrong.