Skip to content

Commit 57bf004

Browse files
Make style in code preview appear, but commented out for now
Co-authored-by: Ron Fu
1 parent 989806e commit 57bf004

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

app/src/components/left/DragDropPanel.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const DragDropPanel = (props): JSX.Element => {
4040

4141
// filter out separator so that it will not appear on the html panel
4242
const htmlTypesToRender = state.HTMLTypes.filter(type => type.name !== 'separator');
43+
4344
return (
4445
<div className="HTMLItems">
4546
<div id="HTMLItemsTopHalf">
@@ -48,19 +49,19 @@ const DragDropPanel = (props): JSX.Element => {
4849
>
4950
<h3>HTML ELEMENTS</h3>
5051
{htmlTypesToRender.map(option => {
51-
if(option.id === 17 || option.id === 18) {
52-
return;
52+
if(option.id !== 17 || option.id !== 18) {
53+
return (
54+
<HTMLItem
55+
name={option.name}
56+
key={`html-${option.name}`}
57+
id={option.id}
58+
Icon={option.icon}
59+
handleDelete={handleDelete}
60+
isThemeLight={isThemeLight}
61+
/>
62+
);
5363
}
54-
return (
55-
<HTMLItem
56-
name={option.name}
57-
key={`html-${option.name}`}
58-
id={option.id}
59-
Icon={option.icon}
60-
handleDelete={handleDelete}
61-
isThemeLight={isThemeLight}
62-
/>
63-
);
64+
6465
})}
6566
<h3>REACT ROUTER</h3>
6667
{htmlTypesToRender.map(option => {

app/src/components/main/Canvas.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function Canvas() {
2525
function onClickHandler(event) {
2626
event.stopPropagation();
2727
// note: a null value for the child id means that we are focusing on the top-level component rather than any child
28+
console.log(state.canvasFocus);
2829
changeFocus(state.canvasFocus.componentId, null);
2930
};
3031

app/src/helperFunctions/generateCode.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const generateUnformattedCode = (
5252
} else if (child.type === 'HTML Element') {
5353
const referencedHTML = HTMLTypes.find(elem => elem.id === child.typeId);
5454
child['tag'] = referencedHTML.tag;
55-
console.log(referencedHTML);
5655
if (
5756
referencedHTML.tag === 'div' ||
5857
referencedHTML.tag === 'separator' ||
@@ -79,10 +78,16 @@ const generateUnformattedCode = (
7978
// Raised formatStyles so that it is declared before it is referenced. It was backwards.
8079
// format styles stored in object to match React inline style format
8180
const formatStyles = (styleObj: any) => {
81+
console.log(styleObj);
82+
8283
if (Object.keys(styleObj).length === 0) return ``;
8384
const formattedStyles = [];
8485
for (let i in styleObj) {
85-
const styleString = i + ': ' + "'" + styleObj[i] + "'";
86+
let styleString = i + ': ' + "'" + styleObj[i] + "'";
87+
// if(i === 'style') {
88+
// styleString = i + ':' + JSON.stringify(styleObj[i]);
89+
// }
90+
8691
formattedStyles.push(styleString);
8792
}
8893
return ' style={{' + formattedStyles.join(',') + '}}';

0 commit comments

Comments
 (0)