Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
InvectivusTaco committed Apr 24, 2024
2 parents 7a369cf + aaf7b18 commit cd95e83
Show file tree
Hide file tree
Showing 21 changed files with 6,346 additions and 5,364 deletions.
142 changes: 73 additions & 69 deletions app/src/components/left/ComponentDrag.tsx
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;

122 changes: 61 additions & 61 deletions app/src/components/left/ComponentsContainer.tsx
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;
Loading

0 comments on commit cd95e83

Please sign in to comment.