Skip to content

Commit 1a719ce

Browse files
committed
Feature: Highlight selected component
1 parent b8eb38c commit 1a719ce

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

frontend/src/Editor/Container.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const Container = ({
2929
currentLayout,
3030
removeComponent,
3131
deviceWindowWidth,
32-
scaleValue
32+
scaleValue,
33+
selectedComponent
3334
}) => {
3435

3536
const styles = {
@@ -276,6 +277,7 @@ export const Container = ({
276277
currentLayout={currentLayout}
277278
scaleValue={scaleValue}
278279
deviceWindowWidth={deviceWindowWidth}
280+
isSelectedComponent={selectedComponent? selectedComponent.id === key : false}
279281
containerProps={{
280282
mode,
281283
snapToGrid,
@@ -292,7 +294,8 @@ export const Container = ({
292294
removeComponent,
293295
currentLayout,
294296
scaleValue,
295-
deviceWindowWidth
297+
deviceWindowWidth,
298+
selectedComponent
296299
}}
297300
/>
298301
}

frontend/src/Editor/DraggableBox.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export const DraggableBox = function DraggableBox({
7070
currentLayout,
7171
layouts,
7272
scaleValue,
73-
deviceWindowWidth
73+
deviceWindowWidth,
74+
isSelectedComponent
7475
}) {
7576
const [isResizing, setResizing] = useState(false);
7677
const [canDrag, setCanDrag] = useState(true);
@@ -168,7 +169,7 @@ export const DraggableBox = function DraggableBox({
168169
size={{ width: scaleWidth(currentLayoutOptions.width, scaleValue) + 6, height: currentLayoutOptions.height + 6}}
169170
position={{ x: currentLayoutOptions ? currentLayoutOptions.left : 0, y: currentLayoutOptions ? currentLayoutOptions.top : 0 }}
170171
defaultSize={{}}
171-
className={`resizer ${mouseOver ? 'resizer-active' : ''}`}
172+
className={`resizer ${isSelectedComponent && !mouseOver ? 'resizer-selected' : ''} ${mouseOver ? 'resizer-active' : ''} `}
172173
onResize={() => setResizing(true)}
173174
resizeHandleClasses={mouseOver ? resizerClasses : {}}
174175
resizeHandleStyles={resizerStyles}

frontend/src/Editor/Editor.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ class Editor extends React.Component {
666666
zoomLevel={zoomLevel}
667667
currentLayout={currentLayout}
668668
deviceWindowWidth={deviceWindowWidth}
669+
selectedComponent={selectedComponent || {}}
669670
scaleValue={scaleValue}
670671
appLoading={isLoading}
671672
onEvent={(eventName, options) => onEvent(this, eventName, options)}

frontend/src/_styles/theme.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ body {
2222
}
2323
}
2424

25+
.resizer-selected {
26+
outline-width: thin;
27+
outline-style: solid;
28+
outline-color: #ffda7e;
29+
}
30+
2531
.query-manager {
2632
.btn {
2733
height: 31px;

0 commit comments

Comments
 (0)