Skip to content

Commit 5439e81

Browse files
authored
Merge pull request #26 from oslabs-beta/staging-faast
UX Fixes: Highlighting in-focus components and a more user friendly CSS update experience by Tyler
2 parents fd328bf + 66cb1f7 commit 5439e81

File tree

6 files changed

+228
-140
lines changed

6 files changed

+228
-140
lines changed

src/components/main/DirectChildComponentNew.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,20 @@ function DirectChildComponent({
6060

6161
// combine all styles so that higher priority style specifications overrule lower priority style specifications
6262
// priority order is 1) style directly set for this child (style), 2) style of the referenced component, and 3) default styling
63-
63+
const interactiveStyle = {
64+
border:
65+
state.canvasFocus.childId === childId
66+
? '3px solid rgb(11,212,112)'
67+
: '1px Solid grey',
68+
boxShadow:
69+
state.canvasFocus.childId === childId ? '1px 1px 3px rgb(11,212,112)' : ''
70+
};
6471
const combinedStyle = combineStyles(
65-
combineStyles(globalDefaultStyle, referencedComponent.style),
66-
style
72+
combineStyles(
73+
combineStyles(globalDefaultStyle, referencedComponent.style),
74+
style
75+
),
76+
interactiveStyle
6777
);
6878

6979
// helper function to render children of direct child components
@@ -102,6 +112,7 @@ function DirectChildComponent({
102112
// combine HTML default stuyles with styles applied to the ichild but give priority to styles applied to the child
103113
const combinedStyle = combineStyles(HTMLDefaultStyle, child.style);
104114
// find the default style of that HTML element and combine in with the custom styles applied to that element
115+
105116
return (
106117
<React.Fragment>
107118
{child.children.length === 0 ? (

src/components/main/DirectChildHTMLNestableNew.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,20 @@ function DirectChildHTMLNestable({
128128
// combine all styles so that higher priority style specifications overrule lower priority style specifications
129129
// priority order is 1) style directly set for this child (style), 2) style of the referenced HTML element, and 3) default styling
130130
const defaultNestableStyle = { ...globalDefaultStyle };
131+
const interactiveStyle = {
132+
border:
133+
state.canvasFocus.childId === childId
134+
? '3px solid rgb(11,212,112)'
135+
: '1px Solid grey',
136+
boxShadow:
137+
state.canvasFocus.childId === childId ? '1px 1px 3px rgb(11,212,112)' : ''
138+
};
139+
131140
defaultNestableStyle['backgroundColor'] = isOver ? 'yellow' : 'white';
132141

133142
const combinedStyle = combineStyles(
134-
combineStyles(defaultNestableStyle, HTMLType.style),
135-
style
143+
combineStyles(combineStyles(defaultNestableStyle, HTMLType.style), style),
144+
interactiveStyle
136145
);
137146

138147
drag(drop(ref));

src/components/main/DirectChildHTMLNew.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ function DirectChildHTML({
6060

6161
// combine all styles so that higher priority style specifications overrule lower priority style specifications
6262
// priority order is 1) style directly set for this child (style), 2) style of the referenced HTML element, and 3) default styling
63-
63+
const interactiveStyle = {
64+
border:
65+
state.canvasFocus.childId === childId
66+
? '3px solid rgb(11,212,112)'
67+
: '1px Solid grey',
68+
boxShadow:
69+
state.canvasFocus.childId === childId ? '1px 1px 3px rgb(11,212,112)' : ''
70+
};
6471
const combinedStyle = combineStyles(
65-
combineStyles(globalDefaultStyle, HTMLType.style),
66-
style
72+
combineStyles(combineStyles(globalDefaultStyle, HTMLType.style), style),
73+
interactiveStyle
6774
);
6875

6976
return (

0 commit comments

Comments
 (0)