Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Refine sidebar spacing and controls

Aswin Asokb6b1fe6c032e
diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsx
index 14449abd7f..6bb128fe2c 100644
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@ -300,7 +300,19 @@ export const Sidebar: React.FC<SidebarProps> = ({
sidebarOpen={open}
{...{ onShowPlanSelector }}
/>
- <Stack sx={{ gap: 0.5 }}>
+ <Stack
+ sx={{
+ gap: 0.75,
+ "&&& > .MuiButton-root": {
+ my: 0,
+ "&:first-of-type": { mt: 1 },
+ "&:hover": {
+ bgcolor:
+ "color-mix(in srgb, var(--mui-palette-text-base) 8%, var(--mui-palette-background-paper))",
+ },
+ },
+ }}
+ >
<ShortcutSection
onCloseSidebar={onClose}
{...{
@@ -322,7 +334,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
),
}}
/>
- <Divider sx={{ my: "2px" }} />
+ <Divider sx={{ mx: 2.5, my: "2px" }} />
<ExitSection onLogout={handleLogout} />
<InfoSection />
</Stack>
@@ -500,13 +512,37 @@ function RootSidebarContents({
sx={{
overflowY: "auto",
scrollbarWidth: "thin",
+ scrollbarColor: "transparent transparent",
+ "&:hover, &:focus-within": {
+ scrollbarColor:
+ "color-mix(in srgb, var(--mui-palette-text-base) 20%, transparent) transparent",
+ },
+ "@supports selector(::-webkit-scrollbar)": {
+ scrollbarWidth: "auto",
+ scrollbarColor: "auto",
+ "&:hover, &:focus-within": {
+ scrollbarColor: "auto",
+ },
+ "&::-webkit-scrollbar": { width: "4px" },
+ "&::-webkit-scrollbar-track": {
+ bgcolor: "transparent",
+ },
+ "&::-webkit-scrollbar-thumb": {
+ bgcolor: "transparent",
+ borderRadius: "4px",
+ },
+ "&:hover::-webkit-scrollbar-thumb, &:focus-within::-webkit-scrollbar-thumb":
+ {
+ bgcolor:
+ "color-mix(in srgb, var(--mui-palette-text-base) 20%, transparent)",
+ },
+ "&::-webkit-scrollbar-button": {
+ display: "none",
+ },
+ },
"& .MuiDivider-root": {
borderColor: "stroke.muted",
},
- "&& .MuiButton-root:hover": {
- bgcolor:
- "color-mix(in srgb, var(--mui-palette-text-base) 8%, var(--mui-palette-background-paper))",
- },
}}
>
{menu}
@@ -537,7 +573,7 @@ interface SectionProps {
}
const HeaderSection: React.FC<SectionProps> = ({ onCloseSidebar }) => (
- <SpacedRow sx={{ mt: { xs: "6px", md: 0 }, pl: "12px", flexShrink: 0 }}>
+ <SpacedRow sx={{ mt: { xs: "6px", md: 1 }, pl: "12px", flexShrink: 0 }}>
<Typography variant="h2" component="h3">
{t("settings")}
</Typography>
@@ -548,7 +584,7 @@ const HeaderSection: React.FC<SectionProps> = ({ onCloseSidebar }) => (
sx={{
width: { md: 40 },
height: { md: 40 },
- bgcolor: { md: "fill.faint" },
+ bgcolor: { md: "fill.muted" },
}}
>
<CloseIcon fontSize="small" />
@@ -767,7 +803,25 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
normalCollectionSummaries.get(summaryID)?.fileCount.toString();
return (
- <>
+ <Stack
+ sx={(theme) => ({
+ mx: 0.5,
+ gap: 0.5,
+ "&&& > .MuiButton-root": {
+ bgcolor: theme.colorSchemes.light?.palette.fill.faint,
+ "&:hover": {
+ bgcolor: theme.colorSchemes.light?.palette.fill.muted,
+ },
+ ...theme.applyStyles("dark", {
+ bgcolor: theme.colorSchemes.dark?.palette.fill.faint,
+ "&:hover": {
+ bgcolor:
+ theme.colorSchemes.dark?.palette.fill.muted,
+ },
+ }),
+ },
+ })}
+ >
<RowButton
startIcon={
<HugeiconsIcon
@@ -820,7 +874,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
caption={summaryCaption(PseudoCollectionID.trash)}
onClick={handleOpenTrashSection}
/>
- </>
+ </Stack>
);
};
diff --git a/web/apps/photos/src/components/sidebar/theme.ts b/web/apps/photos/src/components/sidebar/theme.ts
index d957e968b1..caca9fb6fd 100644
--- a/web/apps/photos/src/components/sidebar/theme.ts
+++ b/web/apps/photos/src/components/sidebar/theme.ts
@@ -5,7 +5,7 @@ const inter =
const sidebarHeadingFont = '"Outfit Variable", Outfit, sans-serif';
-/** Keep the settings palette local, including drawers and portalled menus. */
+// Keep the settings palette local, including drawers and portalled menus.
export const sidebarTheme = (theme: Theme): Theme => {
const colors: CSSObject = {
"--mui-palette-background-default": "#F4F4F4",
@@ -43,7 +43,6 @@ export const sidebarTheme = (theme: Theme): Theme => {
"--mui-palette-FilledInput-bg": "var(--mui-palette-background-default)",
"--mui-palette-FilledInput-hoverBg":
"var(--mui-palette-background-default)",
- "--mui-palette-fixed-switchOn": "#08C225",
"--mui-palette-backdrop-muted": "rgba(0, 0, 0, 0.4)",
...theme.applyStyles("dark", {
"--mui-palette-background-default": "#161616",
@@ -86,8 +85,25 @@ export const sidebarTheme = (theme: Theme): Theme => {
backgroundColor:
"color-mix(in srgb, var(--mui-palette-text-base) 8%, var(--mui-palette-background-paper))",
},
- "& .MuiSwitch-switchBase:not(.Mui-disabled) .MuiSwitch-thumb": {
- color: "var(--mui-palette-background-paper)",
+ "& .MuiSwitch-root": {
+ "--mui-palette-primary-main":
+ theme.colorSchemes.light?.palette.primary.main,
+ "--mui-palette-fill-muted":
+ theme.colorSchemes.light?.palette.fill.muted,
+ "--mui-palette-stroke-muted":
+ theme.colorSchemes.light?.palette.stroke.muted,
+ "--mui-palette-stroke-faint":
+ theme.colorSchemes.light?.palette.stroke.faint,
+ ...theme.applyStyles("dark", {
+ "--mui-palette-primary-main":
+ theme.colorSchemes.dark?.palette.primary.main,
+ "--mui-palette-fill-muted":
+ theme.colorSchemes.dark?.palette.fill.muted,
+ "--mui-palette-stroke-muted":
+ theme.colorSchemes.dark?.palette.stroke.muted,
+ "--mui-palette-stroke-faint":
+ theme.colorSchemes.dark?.palette.stroke.faint,
+ }),
},
'& svg[data-testid="ChevronRightIcon"]:not([data-sidebar-subscription] *)':
{ color: "#969696" },