Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Alternative approach

Manav Rathia6a77ffb9c3f
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 14a0be8271..06f021fcbc 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -227,9 +227,9 @@ const WindowTitlebar: React.FC<React.PropsWithChildren> = ({ children }) => (
// See: [Note: Customize the desktop title bar]
const WindowTitlebarArea = styled(CenteredFlex)`
- z-index: 10000;
- background-color: var(--mui-palette-backdrop-muted);
- backdrop-filter: blur(3px);
+ // z-index: 10000;
+ // background-color: var(--mui-palette-backdrop-muted);
+ // backdrop-filter: blur(3px);
width: 100%;
height: env(titlebar-area-height, 30px /* fallback */);
display: flex;
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 8bbab184af..2ae61def8c 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -5,7 +5,6 @@ import {
Drawer,
IconButton,
Stack,
- styled,
Typography,
type DrawerProps,
} from "@mui/material";
@@ -19,20 +18,47 @@ import type { ModalVisibilityProps } from "../utils/modal";
*
* It is width limited to 375px, and always at full width. It also has a default
* padding.
+ *
+ * It also does some trickery with a sticky opaque bar to ensure that the
+ * content scrolls below our inline title bar on desktop.
*/
-export const SidebarDrawer = styled(Drawer)(({ theme }) => ({
- "& .MuiPaper-root": {
- maxWidth: "375px",
- width: "100%",
- scrollbarWidth: "thin",
- padding: theme.spacing(1),
- // Add extra padding on the top to account for our inline title bar.
- // See: [Note: Customize the desktop title bar]
- ...(wipDesktopCustomTitlebar
- ? { paddingTop: "calc(env(titlebar-area-height) / 2 + 4px)" }
- : {}),
- },
-}));
+export const SidebarDrawer: React.FC<DrawerProps> = ({ children, ...rest }) => (
+ <Drawer
+ {...rest}
+ PaperProps={{
+ sx: {
+ maxWidth: "375px",
+ width: "100%",
+ scrollbarWidth: "thin",
+ // Need to increase specificity to override inherited padding.
+ "&&": { padding: 0 },
+ },
+ }}
+ >
+ {/* If running on desktop, adds a sticky opaque bar at the top with a
+ * z-index greater than the expected sidebar contents. This ensures
+ * that any title bar overlays added by the system (e.g. the traffic
+ * lights on macOS) have a opaque background and the sidebar
+ * contents scroll underneath them.
+ *
+ * See: [Note: Customize the desktop title bar]
+ */}
+ {wipDesktopCustomTitlebar && (
+ <Box
+ sx={{
+ position: "sticky",
+ top: 0,
+ left: 0,
+ width: "100%",
+ minHeight: "env(titlebar-area-height, 30px)",
+ bgcolor: "background.default",
+ zIndex: 10000,
+ }}
+ />
+ )}
+ <Box sx={{ p: 1 }}>{children}</Box>
+ </Drawer>
+);
/**
* Common props for a {@link NestedSidebarDrawer} component. In addition to the