Skip to content

Commit 464abbf

Browse files
committed
refactor: move info box styles to remote helper file
1 parent 443a320 commit 464abbf

File tree

2 files changed

+75
-63
lines changed

2 files changed

+75
-63
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,69 +2153,15 @@ function RemoteFunctions(config = {}) {
21532153
// if element is non-editable we use gray bg color in info box, otherwise normal blue color
21542154
const bgColor = this.element.hasAttribute(GLOBALS.DATA_BRACKETS_ID_ATTR) ? '#4285F4' : '#3C3F41';
21552155

2156+
// we need to insert some dynamic values in the info box styles
21562157
const styles = `
2157-
:host {
2158-
all: initial !important;
2159-
}
2160-
2161-
.phoenix-node-info-box {
2162-
background-color: ${bgColor} !important;
2163-
color: white !important;
2164-
border-radius: 3px !important;
2165-
padding: 5px 8px !important;
2166-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
2167-
font-size: 12px !important;
2168-
font-family: Arial, sans-serif !important;
2169-
z-index: 2147483646 !important;
2170-
position: absolute !important;
2171-
left: ${leftPos}px;
2172-
top: -1000px;
2173-
max-width: 300px !important;
2174-
box-sizing: border-box !important;
2175-
pointer-events: none !important;
2176-
}
2177-
2178-
.tag-line {
2179-
display: flex !important;
2180-
align-items: baseline !important;
2181-
justify-content: space-between !important;
2182-
}
2183-
2184-
.tag-name {
2185-
font-weight: bold !important;
2186-
}
2187-
2188-
.elem-dimensions {
2189-
font-size: 9px !important;
2190-
font-weight: 500 !important;
2191-
opacity: 0.9 !important;
2192-
margin-left: 7px !important;
2193-
flex-shrink: 0 !important;
2194-
}
2195-
2196-
.id-name,
2197-
.class-name,
2198-
.href-info {
2199-
margin-top: 3px !important;
2200-
}
2201-
2202-
.href-info {
2203-
display: flex !important;
2204-
align-items: center !important;
2205-
gap: 6px !important;
2206-
opacity: 0.9 !important;
2207-
letter-spacing: 0.6px !important;
2208-
}
2209-
2210-
.href-info svg {
2211-
width: 13px !important;
2212-
height: 13px !important;
2213-
flex-shrink: 0 !important;
2214-
}
2215-
2216-
.exceeded-classes {
2217-
opacity: 0.8 !important;
2218-
}
2158+
<style>
2159+
${config.styles.infoBox}
2160+
:host {
2161+
--info-box-bg-color: ${bgColor};
2162+
--info-box-left-pos: ${leftPos}px;
2163+
}
2164+
</style>
22192165
`;
22202166

22212167
// add everything to the shadow box

src/LiveDevelopment/RemoteHelper.js

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,76 @@ define(function (require, exports, module) {
318318
}
319319
`;
320320

321+
const infoBoxStyles = `
322+
:host {
323+
all: initial !important;
324+
}
325+
326+
.phoenix-node-info-box {
327+
background-color: var(--info-box-bg-color) !important;
328+
color: white !important;
329+
border-radius: 3px !important;
330+
padding: 5px 8px !important;
331+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
332+
font-size: 12px !important;
333+
font-family: Arial, sans-serif !important;
334+
z-index: 2147483646 !important;
335+
position: absolute !important;
336+
left: var(--info-box-left-pos);
337+
top: -1000px;
338+
max-width: 300px !important;
339+
box-sizing: border-box !important;
340+
pointer-events: none !important;
341+
}
342+
343+
.tag-line {
344+
display: flex !important;
345+
align-items: baseline !important;
346+
justify-content: space-between !important;
347+
}
348+
349+
.tag-name {
350+
font-weight: bold !important;
351+
}
352+
353+
.elem-dimensions {
354+
font-size: 9px !important;
355+
font-weight: 500 !important;
356+
opacity: 0.9 !important;
357+
margin-left: 7px !important;
358+
flex-shrink: 0 !important;
359+
}
360+
361+
.id-name,
362+
.class-name,
363+
.href-info {
364+
margin-top: 3px !important;
365+
}
366+
367+
.href-info {
368+
display: flex !important;
369+
align-items: center !important;
370+
gap: 6px !important;
371+
opacity: 0.9 !important;
372+
letter-spacing: 0.6px !important;
373+
}
374+
375+
.href-info svg {
376+
width: 13px !important;
377+
height: 13px !important;
378+
flex-shrink: 0 !important;
379+
}
380+
381+
.exceeded-classes {
382+
opacity: 0.8 !important;
383+
}
384+
`;
385+
321386
const remoteStyles = {
322387
optionsBox: optionsBoxStyles,
323388
optionsBoxImageGallerySelected: optionsBoxImageGallerySelectedStyles,
324-
optionsBoxDropdown: optionsBoxDropdownStyles
389+
optionsBoxDropdown: optionsBoxDropdownStyles,
390+
infoBox: infoBoxStyles
325391
};
326392

327393
exports.remoteStrings = remoteStrings;

0 commit comments

Comments
 (0)