mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 02:24:58 +00:00
move scrollbar styling to @pybricks/ide-docs
This makes the scrollbar flashing less noticeable, but there is still a bit of a flash in dark mode due to the fact that we are still injecting the class in the load event in that case.
This commit is contained in:
@@ -145,53 +145,6 @@ function App(): JSX.Element {
|
||||
}
|
||||
});
|
||||
|
||||
const style = document.createElement('style');
|
||||
|
||||
// TODO: how to get these programmatically from values set in variables.scss?
|
||||
const iconColor = '#5c7080';
|
||||
const iconColorHover = '#182026';
|
||||
const appBackgroundColor = '#e8e8e8';
|
||||
const darkIconColor = '#a7b6c2';
|
||||
const darkIconColorHover = '#f5f8fa';
|
||||
const darkAppBackgroundColor = '#293742';
|
||||
|
||||
// This is scrollbar style coped from index.scss.
|
||||
style.innerText = `
|
||||
::-webkit-scrollbar {
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.${Classes.DARK} ::-webkit-scrollbar-track {
|
||||
background: ${darkAppBackgroundColor};
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: ${appBackgroundColor};
|
||||
}
|
||||
|
||||
.${Classes.DARK} ::-webkit-scrollbar-thumb {
|
||||
border-color: ${darkAppBackgroundColor};
|
||||
background: ${darkIconColor};
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-width: 3px;
|
||||
border-style: solid;
|
||||
border-radius: 8px;
|
||||
border-color: ${appBackgroundColor};
|
||||
background: ${iconColor};
|
||||
}
|
||||
|
||||
.${Classes.DARK} ::-webkit-scrollbar-thumb:hover {
|
||||
background: ${darkIconColorHover};
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: ${iconColorHover};
|
||||
}
|
||||
`;
|
||||
contentWindow.document.head.appendChild(style);
|
||||
|
||||
if (document.body.classList.contains(Classes.DARK)) {
|
||||
contentWindow.document.documentElement.classList.add(
|
||||
Classes.DARK,
|
||||
|
||||
Reference in New Issue
Block a user