Skip to content

armgit / ente

Public Imported from GitHub
0

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

style(photos):align-inline-album-layout-header

Aswin Asokdc31cd2ffc13
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 4597eb7eea..c0aeb67b94 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -2580,6 +2580,7 @@ const ManageLayout: React.FC<ManageLayoutProps> = ({
{...layoutOptionsVisibilityProps}
onRootClose={onRootClose}
title={t("album_layout")}
+ titleInline={variant == "inline"}
>
<Stack sx={{ py: "20px", px: "8px" }}>
<RowButtonGroup>
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 1408f44aa3..72bee17fd9 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -124,6 +124,7 @@ type SidebarDrawerTitlebarProps = Pick<
actionButton?: React.ReactNode;
showRootCloseButton?: boolean;
showBackButton?: boolean;
+ titleInline?: boolean;
};
export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
@@ -134,54 +135,74 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
actionButton,
showRootCloseButton = true,
showBackButton = true,
-}) => (
- <Stack sx={{ gap: "4px" }}>
+ titleInline = false,
+}) => {
+ const titleContent = (
<Stack
- direction="row"
sx={{
- justifyContent: showBackButton ? "space-between" : "flex-end",
+ pl: titleInline ? "8px" : "calc(16px + 0.5rem)",
+ pr: "16px",
+ gap: "4px",
+ ...(titleInline && { flex: 1, minWidth: 0 }),
}}
>
- {showBackButton && (
- <IconButton
- aria-label="Back"
- onClick={onClose}
- color="primary"
- sx={{ ml: "0.5rem" }}
+ <Typography variant="h3" sx={{ fontSize: "22px" }}>
+ {title}
+ </Typography>
+ {(!titleInline || caption) && (
+ <Typography
+ variant="small"
+ sx={{
+ color: "text.muted",
+ wordBreak: "break-all",
+ minHeight: "17px",
+ }}
>
- <ArrowBackIcon />
- </IconButton>
+ {caption}
+ </Typography>
)}
- <Stack direction="row" sx={{ gap: "4px" }}>
- {actionButton && actionButton}
- {showRootCloseButton && (
+ </Stack>
+ );
+
+ return (
+ <Stack sx={{ gap: "4px" }}>
+ <Stack
+ direction="row"
+ sx={{
+ justifyContent: showBackButton
+ ? "space-between"
+ : "flex-end",
+ ...(titleInline && { alignItems: "center" }),
+ }}
+ >
+ {showBackButton && (
<IconButton
- aria-label="Close"
- onClick={onRootClose}
- color="secondary"
+ aria-label="Back"
+ onClick={onClose}
+ color="primary"
+ sx={{ ml: "0.5rem" }}
>
- <CloseIcon />
+ <ArrowBackIcon />
</IconButton>
)}
+ {titleInline && titleContent}
+ <Stack direction="row" sx={{ gap: "4px" }}>
+ {actionButton && actionButton}
+ {showRootCloseButton && (
+ <IconButton
+ aria-label="Close"
+ onClick={onRootClose}
+ color="secondary"
+ >
+ <CloseIcon />
+ </IconButton>
+ )}
+ </Stack>
</Stack>
+ {!titleInline && titleContent}
</Stack>
- <Stack sx={{ pl: "calc(16px + 0.5rem)", pr: "16px", gap: "4px" }}>
- <Typography variant="h3" sx={{ fontSize: "22px" }}>
- {title}
- </Typography>
- <Typography
- variant="small"
- sx={{
- color: "text.muted",
- wordBreak: "break-all",
- minHeight: "17px",
- }}
- >
- {caption}
- </Typography>
- </Stack>
- </Stack>
-);
+ );
+};
export const TitledNestedSidebarDrawer: React.FC<
React.PropsWithChildren<