Skip to content

Commit 2389771

Browse files
committed
refactor: move options box styles to remote helper file
1 parent 9e7a9a4 commit 2389771

File tree

3 files changed

+72
-62
lines changed

3 files changed

+72
-62
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,68 +1534,10 @@ function RemoteFunctions(config = {}) {
15341534
</span>
15351535
</div>`;
15361536

1537-
let styles = `
1538-
:host {
1539-
all: initial !important;
1540-
}
1541-
1542-
.phoenix-more-options-box {
1543-
background-color: #4285F4 !important;
1544-
color: white !important;
1545-
border-radius: 3px !important;
1546-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
1547-
font-size: 12px !important;
1548-
font-family: Arial, sans-serif !important;
1549-
z-index: 2147483646 !important;
1550-
position: absolute !important;
1551-
left: -1000px;
1552-
top: -1000px;
1553-
box-sizing: border-box !important;
1554-
}
1555-
1556-
.node-options {
1557-
display: flex !important;
1558-
align-items: center !important;
1559-
}
1560-
1561-
.node-options span {
1562-
padding: 4px 3.9px !important;
1563-
cursor: pointer !important;
1564-
display: flex !important;
1565-
align-items: center !important;
1566-
border-radius: 0 !important;
1567-
}
1568-
1569-
.node-options span:first-child {
1570-
border-radius: 3px 0 0 3px !important;
1571-
}
1572-
1573-
.node-options span:last-child {
1574-
border-radius: 0 3px 3px 0 !important;
1575-
}
1576-
1577-
.node-options span:hover {
1578-
background-color: rgba(255, 255, 255, 0.15) !important;
1579-
}
1580-
1581-
.node-options span > svg {
1582-
width: 16px !important;
1583-
height: 16px !important;
1584-
display: block !important;
1585-
}
1586-
`;
1587-
1537+
let styles = config.styles.optionsBoxStyles;
15881538
// to highlight that in a different color, to show the selected state
15891539
if (imageGallerySelected) {
1590-
styles += `
1591-
.node-options span[data-action="image-gallery"] {
1592-
background-color: rgba(50, 50, 220, 0.5) !important;
1593-
}
1594-
1595-
.node-options span[data-action="image-gallery"]:hover {
1596-
background-color: rgba(100, 100, 230, 0.6) !important;
1597-
}
1598-
`;
1540+
styles += config.styles.optionsBoxImageGallerySelectedStyles;
15991541
}
16001542

16011543
// add everything to the shadow box

src/LiveDevelopment/RemoteHelper.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,73 @@ define(function (require, exports, module) {
183183
`
184184
};
185185

186+
const optionsBoxStyles = `
187+
:host {
188+
all: initial !important;
189+
}
190+
191+
.phoenix-more-options-box {
192+
background-color: #4285F4 !important;
193+
color: white !important;
194+
border-radius: 3px !important;
195+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
196+
font-size: 12px !important;
197+
font-family: Arial, sans-serif !important;
198+
z-index: 2147483646 !important;
199+
position: absolute !important;
200+
left: -1000px;
201+
top: -1000px;
202+
box-sizing: border-box !important;
203+
}
204+
205+
.node-options {
206+
display: flex !important;
207+
align-items: center !important;
208+
}
209+
210+
.node-options span {
211+
padding: 4px 3.9px !important;
212+
cursor: pointer !important;
213+
display: flex !important;
214+
align-items: center !important;
215+
border-radius: 0 !important;
216+
}
217+
218+
.node-options span:first-child {
219+
border-radius: 3px 0 0 3px !important;
220+
}
221+
222+
.node-options span:last-child {
223+
border-radius: 0 3px 3px 0 !important;
224+
}
225+
226+
.node-options span:hover {
227+
background-color: rgba(255, 255, 255, 0.15) !important;
228+
}
229+
230+
.node-options span > svg {
231+
width: 16px !important;
232+
height: 16px !important;
233+
display: block !important;
234+
}
235+
`;
236+
237+
const optionsBoxImageGallerySelectedStyles = `
238+
.node-options span[data-action="image-gallery"] {
239+
background-color: rgba(50, 50, 220, 0.5) !important;
240+
}
241+
242+
.node-options span[data-action="image-gallery"]:hover {
243+
background-color: rgba(100, 100, 230, 0.6) !important;
244+
}
245+
`;
246+
247+
const remoteStyles = {
248+
optionsBoxStyles: optionsBoxStyles,
249+
optionsBoxImageGallerySelectedStyles: optionsBoxImageGallerySelectedStyles
250+
};
251+
186252
exports.remoteStrings = remoteStrings;
187253
exports.remoteIcons = remoteIcons;
254+
exports.remoteStyles = remoteStyles;
188255
});

src/LiveDevelopment/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ define(function main(require, exports, module) {
9191
elemHighlights: "hover", // default value, this will get updated when the extension loads
9292
showRulerLines: false, // default value, this will get updated when the extension loads
9393
imageGalleryState: _getImageGalleryState(), // image gallery selected state
94-
strings: RemoteHelper.remoteStrings, // strings that remote functions need
95-
icons: RemoteHelper.remoteIcons // icons used by remote functions file
94+
strings: RemoteHelper.remoteStrings,
95+
icons: RemoteHelper.remoteIcons,
96+
styles: RemoteHelper.remoteStyles
9697
};
9798

9899
// Status labels/styles are ordered: error, not connected, progress1, progress2, connected.

0 commit comments

Comments
 (0)