Skip to content

Commit 443a320

Browse files
committed
refactor: move options box dropdown styles to remote helper
1 parent 2389771 commit 443a320

File tree

2 files changed

+80
-78
lines changed

2 files changed

+80
-78
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

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

1537-
let styles = config.styles.optionsBoxStyles;
1537+
let styles = config.styles.optionsBox;
15381538
// to highlight that in a different color, to show the selected state
15391539
if (imageGallerySelected) {
1540-
styles += config.styles.optionsBoxImageGallerySelectedStyles;
1540+
styles += config.styles.optionsBoxImageGallerySelected;
15411541
}
15421542

15431543
// add everything to the shadow box
@@ -1914,80 +1914,7 @@ function RemoteFunctions(config = {}) {
19141914
</div>
19151915
`;
19161916

1917-
let styles = `
1918-
:host {
1919-
all: initial !important;
1920-
}
1921-
1922-
.phoenix-dropdown {
1923-
background-color: #2c2c2c !important;
1924-
color: #cdcdcd !important;
1925-
border: 1px solid #4a4a4a !important;
1926-
border-radius: 6px !important;
1927-
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
1928-
font-size: 13px !important;
1929-
font-family: Arial, sans-serif !important;
1930-
z-index: 2147483647 !important;
1931-
position: absolute !important;
1932-
left: -1000px;
1933-
top: -1000px;
1934-
box-sizing: border-box !important;
1935-
min-width: 130px !important;
1936-
padding: 3px 0 !important;
1937-
overflow: hidden !important;
1938-
}
1939-
1940-
.more-options-dropdown {
1941-
display: flex !important;
1942-
flex-direction: column !important;
1943-
}
1944-
1945-
.dropdown-item {
1946-
padding: 7px 14px !important;
1947-
cursor: pointer !important;
1948-
white-space: nowrap !important;
1949-
user-select: none !important;
1950-
display: flex !important;
1951-
align-items: center !important;
1952-
gap: 6px !important;
1953-
}
1954-
1955-
.dropdown-item:hover {
1956-
background-color: #3c3f41 !important;
1957-
}
1958-
1959-
.item-icon {
1960-
display: flex !important;
1961-
align-items: center !important;
1962-
justify-content: center !important;
1963-
width: 16px !important;
1964-
height: 16px !important;
1965-
flex-shrink: 0 !important;
1966-
}
1967-
1968-
.item-icon svg {
1969-
width: 16px !important;
1970-
height: 16px !important;
1971-
display: block !important;
1972-
}
1973-
1974-
.item-label {
1975-
flex: 1 !important;
1976-
}
1977-
1978-
.dropdown-separator {
1979-
height: 1px !important;
1980-
background-color: #4a4a4a !important;
1981-
margin: 2px 0 !important;
1982-
}
1983-
1984-
.item-checkmark {
1985-
margin-left: auto !important;
1986-
padding-left: 4px !important;
1987-
font-size: 14px !important;
1988-
}
1989-
`;
1990-
1917+
let styles = config.styles.optionsBoxDropdown;
19911918
shadow.innerHTML = `<style>${styles}</style><div class="phoenix-dropdown">${content}</div>`;
19921919
this._shadow = shadow;
19931920
},

src/LiveDevelopment/RemoteHelper.js

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,84 @@ define(function (require, exports, module) {
244244
}
245245
`;
246246

247+
const optionsBoxDropdownStyles = `
248+
:host {
249+
all: initial !important;
250+
}
251+
252+
.phoenix-dropdown {
253+
background-color: #2c2c2c !important;
254+
color: #cdcdcd !important;
255+
border: 1px solid #4a4a4a !important;
256+
border-radius: 6px !important;
257+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
258+
font-size: 13px !important;
259+
font-family: Arial, sans-serif !important;
260+
z-index: 2147483647 !important;
261+
position: absolute !important;
262+
left: -1000px;
263+
top: -1000px;
264+
box-sizing: border-box !important;
265+
min-width: 130px !important;
266+
padding: 3px 0 !important;
267+
overflow: hidden !important;
268+
}
269+
270+
.more-options-dropdown {
271+
display: flex !important;
272+
flex-direction: column !important;
273+
}
274+
275+
.dropdown-item {
276+
padding: 7px 14px !important;
277+
cursor: pointer !important;
278+
white-space: nowrap !important;
279+
user-select: none !important;
280+
display: flex !important;
281+
align-items: center !important;
282+
gap: 6px !important;
283+
}
284+
285+
.dropdown-item:hover {
286+
background-color: #3c3f41 !important;
287+
}
288+
289+
.item-icon {
290+
display: flex !important;
291+
align-items: center !important;
292+
justify-content: center !important;
293+
width: 16px !important;
294+
height: 16px !important;
295+
flex-shrink: 0 !important;
296+
}
297+
298+
.item-icon svg {
299+
width: 16px !important;
300+
height: 16px !important;
301+
display: block !important;
302+
}
303+
304+
.item-label {
305+
flex: 1 !important;
306+
}
307+
308+
.dropdown-separator {
309+
height: 1px !important;
310+
background-color: #4a4a4a !important;
311+
margin: 2px 0 !important;
312+
}
313+
314+
.item-checkmark {
315+
margin-left: auto !important;
316+
padding-left: 4px !important;
317+
font-size: 14px !important;
318+
}
319+
`;
320+
247321
const remoteStyles = {
248-
optionsBoxStyles: optionsBoxStyles,
249-
optionsBoxImageGallerySelectedStyles: optionsBoxImageGallerySelectedStyles
322+
optionsBox: optionsBoxStyles,
323+
optionsBoxImageGallerySelected: optionsBoxImageGallerySelectedStyles,
324+
optionsBoxDropdown: optionsBoxDropdownStyles
250325
};
251326

252327
exports.remoteStrings = remoteStrings;

0 commit comments

Comments
 (0)