Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos][web] Keep settings search visible while scrolling

AswinAsokddd1b6d3f947
diff --git a/web/apps/photos/src/components/sidebar/SettingsSearch.tsx b/web/apps/photos/src/components/sidebar/SettingsSearch.tsx
index 3698aa9df6..4fb5bf6a3d 100644
--- a/web/apps/photos/src/components/sidebar/SettingsSearch.tsx
+++ b/web/apps/photos/src/components/sidebar/SettingsSearch.tsx
@@ -49,7 +49,14 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
});
return (
- <>
+ <Box
+ sx={{
+ display: "flex",
+ flexDirection: "column",
+ flex: 1,
+ minHeight: 0,
+ }}
+ >
<Box
{...getRootProps({
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => {
@@ -59,7 +66,13 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
}
},
})}
- sx={{ mb: 2 }}
+ sx={{
+ display: "flex",
+ flexDirection: "column",
+ flex: searching ? 1 : "0 0 auto",
+ minHeight: 0,
+ mb: 2,
+ }}
>
<Stack
direction="row"
@@ -68,6 +81,7 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
gap: 1,
px: 2,
height: 52,
+ flexShrink: 0,
borderRadius: "16px",
bgcolor: "background.paper",
"&:focus-within": {
@@ -123,6 +137,7 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
{...getListboxProps()}
aria-label={t("search_settings")}
sx={{
+ position: "relative",
display: "flex",
flexDirection: "column",
gap: 0.75,
@@ -130,6 +145,9 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
p: 0,
mb: 0,
mt: 2,
+ flex: options.length ? 1 : undefined,
+ minHeight: 0,
+ overflowY: "auto",
}}
>
{options.map((option, index) => {
@@ -156,6 +174,7 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
px: 1.5,
py: 1.5,
minHeight: 64,
+ flexShrink: 0,
boxSizing: "border-box",
borderRadius: "16px",
border: "1px solid",
@@ -241,7 +260,11 @@ export function SettingsSearch({ onSelect, children }: SettingsSearchProps) {
</>
)}
</Box>
- {!searching && children}
- </>
+ {!searching && (
+ <Box sx={{ flex: 1, minHeight: 0, overflowY: "auto" }}>
+ {children}
+ </Box>
+ )}
+ </Box>
);
}
diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsx
index 978002bc36..6f143a39f6 100644
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@ -431,7 +431,19 @@ function RootSidebarContents({
if (!wide) {
return (
<>
- <SidebarDrawer open={open} onClose={onClose} maxWidth="440px">
+ <SidebarDrawer
+ open={open}
+ onClose={onClose}
+ maxWidth="440px"
+ sx={{
+ "& .MuiDrawer-paper > .MuiBox-root": {
+ display: "flex",
+ flexDirection: "column",
+ flex: 1,
+ minHeight: 0,
+ },
+ }}
+ >
<HeaderSection onCloseSidebar={onClose} />
{menu}
</SidebarDrawer>
@@ -516,7 +528,10 @@ function RootSidebarContents({
>
<Box
sx={{
- overflowY: "auto",
+ display: "flex",
+ flexDirection: "column",
+ minHeight: 0,
+ overflow: "hidden",
"& .MuiDivider-root": {
borderColor: "stroke.muted",
},