Merge pull request #6361 from tudi2d/sidebar-scrolling-similar

Show scroll bar on hover only
This commit is contained in:
Fredrik Adelöw
2021-07-06 15:44:05 +02:00
committed by GitHub
2 changed files with 26 additions and 9 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Show scroll bar of the sidebar wrapper only on hover
@@ -21,8 +21,10 @@ import {
makeStyles,
styled,
TextField,
Theme,
Typography,
} from '@material-ui/core';
import { CreateCSSProperties } from '@material-ui/core/styles/withStyles';
import SearchIcon from '@material-ui/icons/Search';
import clsx from 'clsx';
import React, {
@@ -291,14 +293,8 @@ export const SidebarDivider = styled('hr')({
margin: '12px 0px',
});
export const SidebarScrollWrapper = styled('div')(({ theme }) => ({
flex: '0 1 auto',
overflowX: 'hidden',
// 5px space to the right of the scrollbar
width: 'calc(100% - 5px)',
// Display at least one item in the container
// Question: Can this be a config/theme variable - if so, which? :/
minHeight: '48px',
const styledScrollbar = (theme: Theme): CreateCSSProperties => ({
overflowY: 'auto',
'&::-webkit-scrollbar': {
backgroundColor: theme.palette.background.default,
width: '5px',
@@ -308,4 +304,20 @@ export const SidebarScrollWrapper = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.text.hint,
borderRadius: '5px',
},
}));
});
export const SidebarScrollWrapper = styled('div')(({ theme }) => {
const scrollbarStyles = styledScrollbar(theme);
return {
flex: '0 1 auto',
overflowX: 'hidden',
// 5px space to the right of the scrollbar
width: 'calc(100% - 5px)',
// Display at least one item in the container
// Question: Can this be a config/theme variable - if so, which? :/
minHeight: '48px',
overflowY: 'hidden',
'@media (hover: none)': scrollbarStyles,
'&:hover': scrollbarStyles,
};
});