Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Use shared minimal scrollbar styling

Aswin Asok3d24f67fa6cb
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 54d0d820c3..7777053824 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -571,22 +571,6 @@ const createSelectStyles = (
flexDirection: "column",
gap: "8px",
padding: 0,
- scrollbarWidth: "thin",
- scrollbarColor: `${theme.vars.palette.stroke.muted} transparent`,
- "@supports selector(::-webkit-scrollbar)": {
- scrollbarWidth: "auto",
- scrollbarColor: "auto",
- "&::-webkit-scrollbar": { width: "4px" },
- "&::-webkit-scrollbar-track": { backgroundColor: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- backgroundColor: theme.vars.palette.stroke.muted,
- borderRadius: "4px",
- },
- "&::-webkit-scrollbar-thumb:hover": {
- backgroundColor: theme.vars.palette.text.muted,
- },
- "&::-webkit-scrollbar-button": { display: "none" },
- },
}),
group: (style) => ({
...style,
diff --git a/web/apps/photos/src/components/gallery/BarImpl.tsx b/web/apps/photos/src/components/gallery/BarImpl.tsx
index a04eeb60ae..bf8255ca90 100644
--- a/web/apps/photos/src/components/gallery/BarImpl.tsx
+++ b/web/apps/photos/src/components/gallery/BarImpl.tsx
@@ -203,7 +203,6 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
{({ width, height }) => (
<FixedSizeList
ref={listRef}
- outerElementType={BarScrollContainer}
width={width}
height={height}
itemData={itemData}
@@ -397,32 +396,6 @@ export const GalleryBarImpl: React.FC<GalleryBarImplProps> = ({
);
};
-const BarScrollContainer = styled("div")({
- 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": { backgroundColor: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- backgroundColor: "transparent",
- borderRadius: "4px",
- },
- "&:hover::-webkit-scrollbar-thumb, &:focus-within::-webkit-scrollbar-thumb":
- {
- backgroundColor:
- "color-mix(in srgb, var(--mui-palette-text-base) 20%, transparent)",
- },
- "&::-webkit-scrollbar-button": { display: "none" },
- },
-});
-
type ItemData =
| {
type: "collections";
diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsx
index 78aa26565e..44ac31968e 100644
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@ -565,35 +565,6 @@ function RootSidebarContents({
<Box
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",
},
diff --git a/web/apps/photos/src/styles/global.css b/web/apps/photos/src/styles/global.css
index 1d8a983599..c1ef2319f7 100644
--- a/web/apps/photos/src/styles/global.css
+++ b/web/apps/photos/src/styles/global.css
@@ -12,3 +12,72 @@ body {
flex-direction: column;
height: 100%;
}
+
+:where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)) {
+ scrollbar-width: thin;
+ scrollbar-color: transparent transparent;
+}
+
+:where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)):is(
+ :hover,
+ :focus-within
+) {
+ scrollbar-color: color-mix(
+ in srgb,
+ var(--mui-palette-text-base) 20%,
+ transparent
+ )
+ transparent;
+}
+
+:where([data-custom-scrollbar]) {
+ scrollbar-color: auto;
+}
+
+@supports selector(::-webkit-scrollbar) {
+ :where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)),
+ :where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)):is(
+ :hover,
+ :focus-within
+ ) {
+ scrollbar-width: auto;
+ scrollbar-color: auto;
+ }
+
+ :where(
+ :not([data-custom-scrollbar], [data-custom-scrollbar] *)
+ )::-webkit-scrollbar {
+ width: 4px;
+ height: 4px;
+ }
+
+ :where(
+ :not([data-custom-scrollbar], [data-custom-scrollbar] *)
+ )::-webkit-scrollbar-track {
+ background-color: transparent;
+ }
+
+ :where(
+ :not([data-custom-scrollbar], [data-custom-scrollbar] *)
+ )::-webkit-scrollbar-thumb {
+ background-color: transparent;
+ border-radius: 4px;
+ }
+
+ :where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)):is(
+ :hover,
+ :focus-within
+ )::-webkit-scrollbar-thumb {
+ background-color: color-mix(
+ in srgb,
+ var(--mui-palette-text-base) 20%,
+ transparent
+ );
+ }
+
+ :where(
+ :not([data-custom-scrollbar], [data-custom-scrollbar] *)
+ )::-webkit-scrollbar-button {
+ display: none;
+ }
+}
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 3975eca5db..1408f44aa3 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -9,7 +9,7 @@ import {
Typography,
type DrawerProps,
} from "@mui/material";
-import { isDesktop } from "ente-base/app";
+import { appName, isDesktop } from "ente-base/app";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import React, { useContext } from "react";
import {
@@ -58,7 +58,7 @@ export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
boxShadow: "none",
border: 0,
}),
- scrollbarWidth: "thin",
+ ...(appName !== "photos" && { scrollbarWidth: "thin" }),
// Extra specificity overrides inherited padding.
"&&": { padding: 0 },
},
diff --git a/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx b/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
index c9693f0497..b1f8a89189 100644
--- a/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
+++ b/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
@@ -160,7 +160,7 @@ export function UploadProgressDetails() {
{t("failed_uploads_hint")}
</Typography>
)}
- <Box sx={uploadRowsSx(isDone)}>
+ <Box sx={uploadRowsSx(isDone)} data-custom-scrollbar>
{activeStat == "inProgress" ? (
inProgressUploads.length ? (
inProgressUploads.map(
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index f0a0e69282..5d197aa696 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -1150,7 +1150,10 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
</CloseButton>
</Header>
- <CommentsContainer ref={commentsContainerRef}>
+ <CommentsContainer
+ ref={commentsContainerRef}
+ data-custom-scrollbar
+ >
{loading ? (
<LoadingContainer>
<CircularProgress size={32} />
@@ -1456,7 +1459,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
</ReplyingToContent>
</ReplyingToBar>
)}
- <InputWrapper>
+ <InputWrapper data-custom-scrollbar>
<StyledTextField
fullWidth
multiline
diff --git a/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx b/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
index 094615dd9f..f8ee4d4de8 100644
--- a/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
+++ b/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
@@ -192,7 +192,7 @@ export const LikeAlbumSelectorModal: React.FC<LikeAlbumSelectorModalProps> = ({
</LikeAllButton>
</AlbumsHeader>
- <AlbumsList>
+ <AlbumsList data-custom-scrollbar>
{albums.map((album) => {
const isLiked = likedAlbumIDs.has(album.id);
return (
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index 7f056e3624..ecdbdd157c 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -549,7 +549,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
</CloseButton>
</Header>
- <LikersContainer>
+ <LikersContainer data-custom-scrollbar>
{loading ? (
<LoadingContainer>
<CircularProgress size={32} />