Better blur effect in sidebar

This commit is contained in:
Dustin Brett
2025-06-13 23:14:45 -07:00
parent 61d287cf12
commit 2ab1000528
5 changed files with 18 additions and 20 deletions

View File

@@ -14,7 +14,6 @@ const StyledSidebar = styled.nav`
z-index: 1; z-index: 1;
&:hover:not(&.collapsed) { &:hover:not(&.collapsed) {
backdrop-filter: ${({ theme }) => `blur(${theme.sizes.taskbar.panelBlur})`};
background-color: hsl(0 0% 10% / 95%); background-color: hsl(0 0% 10% / 95%);
box-shadow: 8px 0 5px -5px hsl(0 0% 10% / 50%); box-shadow: 8px 0 5px -5px hsl(0 0% 10% / 50%);
transition: transition:
@@ -26,6 +25,18 @@ const StyledSidebar = styled.nav`
@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) { @supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) {
background-color: hsl(0 0% 10% / 75%); background-color: hsl(0 0% 10% / 75%);
} }
&::before {
backdrop-filter: ${({ theme }) =>
`blur(${theme.sizes.taskbar.panelBlur})`};
background-color: hsl(0 0% 10% / 50%);
content: "";
height: 100%;
margin-top: -4px;
position: absolute;
width: 100%;
z-index: -100000;
}
} }
&.collapsed { &.collapsed {

View File

@@ -42,7 +42,10 @@ const Sidebar: FC<SidebarProps> = ({ height }) => {
const expandTimer = useRef(0); const expandTimer = useRef(0);
const sidebarRef = useRef<HTMLElement>(null); const sidebarRef = useRef<HTMLElement>(null);
const clearTimer = (): void => { const clearTimer = (): void => {
if (expandTimer.current) clearTimeout(expandTimer.current); if (expandTimer.current) {
clearTimeout(expandTimer.current);
expandTimer.current = 0;
}
}; };
const topButtons: SidebarButtons = useMemo( const topButtons: SidebarButtons = useMemo(
() => [ () => [

View File

@@ -17,6 +17,8 @@ const StyledStartMenu = styled(motion.nav)<StyledStartMenuProps>`
${({ theme }) => ${({ theme }) =>
TaskbarPanel(theme.sizes.startMenu.maxHeight, theme.sizes.startMenu.size)} TaskbarPanel(theme.sizes.startMenu.maxHeight, theme.sizes.startMenu.size)}
backdrop-filter: ${({ theme }) => `blur(${theme.sizes.taskbar.panelBlur})`};
${StyledFileManager} { ${StyledFileManager} {
${ScrollBars(THIN_SCROLLBAR_WIDTH, -2, -1)}; ${ScrollBars(THIN_SCROLLBAR_WIDTH, -2, -1)};
margin-top: 0; margin-top: 0;

View File

@@ -5,7 +5,6 @@ import FileManager from "components/system/Files/FileManager";
import Sidebar from "components/system/StartMenu/Sidebar"; import Sidebar from "components/system/StartMenu/Sidebar";
import StyledStartMenu from "components/system/StartMenu/StyledStartMenu"; import StyledStartMenu from "components/system/StartMenu/StyledStartMenu";
import { updateInputValueOnReactElement } from "components/system/Taskbar/Search/functions"; import { updateInputValueOnReactElement } from "components/system/Taskbar/Search/functions";
import StyledBackground from "components/system/Taskbar/StyledBackground";
import { import {
SEARCH_BUTTON_TITLE, SEARCH_BUTTON_TITLE,
START_BUTTON_TITLE, START_BUTTON_TITLE,
@@ -105,7 +104,6 @@ const StartMenu: FC<StartMenuProps> = ({ toggleStartMenu }) => {
{...startMenuTransition} {...startMenuTransition}
{...FOCUSABLE_ELEMENT} {...FOCUSABLE_ELEMENT}
> >
<StyledBackground $height={height} />
<Sidebar height={height} /> <Sidebar height={height} />
<FileManager <FileManager
url={START_MENU_PATH} url={START_MENU_PATH}

View File

@@ -1,16 +0,0 @@
import styled from "styled-components";
type StyledBackgroundProps = {
$height?: string;
};
const StyledBackground = styled.span<StyledBackgroundProps>`
backdrop-filter: ${({ theme }) => `blur(${theme.sizes.taskbar.panelBlur})`};
height: ${({ $height }) => $height};
inset: 0;
position: absolute;
width: 100%;
z-index: -1;
`;
export default StyledBackground;