Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Apply global scrollbar style to all scroll areas

Aswin Asokbbe6387b4613
diff --git a/web/apps/photos/src/styles/global.css b/web/apps/photos/src/styles/global.css
index c1ef2319f7..61852886f0 100644
--- a/web/apps/photos/src/styles/global.css
+++ b/web/apps/photos/src/styles/global.css
@@ -13,15 +13,12 @@ body {
height: 100%;
}
-:where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)) {
+:where(*) {
scrollbar-width: thin;
scrollbar-color: transparent transparent;
}
-:where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)):is(
- :hover,
- :focus-within
-) {
+:where(*:hover, *:focus-within) {
scrollbar-color: color-mix(
in srgb,
var(--mui-palette-text-base) 20%,
@@ -30,44 +27,27 @@ body {
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
- ) {
+ :where(*) {
scrollbar-width: auto;
scrollbar-color: auto;
}
- :where(
- :not([data-custom-scrollbar], [data-custom-scrollbar] *)
- )::-webkit-scrollbar {
+ :where(*)::-webkit-scrollbar {
width: 4px;
height: 4px;
}
- :where(
- :not([data-custom-scrollbar], [data-custom-scrollbar] *)
- )::-webkit-scrollbar-track {
+ :where(*)::-webkit-scrollbar-track {
background-color: transparent;
}
- :where(
- :not([data-custom-scrollbar], [data-custom-scrollbar] *)
- )::-webkit-scrollbar-thumb {
+ :where(*)::-webkit-scrollbar-thumb {
background-color: transparent;
border-radius: 4px;
}
- :where(:not([data-custom-scrollbar], [data-custom-scrollbar] *)):is(
- :hover,
- :focus-within
- )::-webkit-scrollbar-thumb {
+ :where(*:hover, *:focus-within)::-webkit-scrollbar-thumb {
background-color: color-mix(
in srgb,
var(--mui-palette-text-base) 20%,
@@ -75,9 +55,7 @@ body {
);
}
- :where(
- :not([data-custom-scrollbar], [data-custom-scrollbar] *)
- )::-webkit-scrollbar-button {
+ :where(*)::-webkit-scrollbar-button {
display: none;
}
}
diff --git a/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx b/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
index b1f8a89189..4419961fe5 100644
--- a/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
+++ b/web/packages/gallery/components/upload-progress/UploadProgressDetails.tsx
@@ -1,5 +1,6 @@
import { Box, Button, Stack, Typography, type Theme } from "@mui/material";
import type { SystemStyleObject } from "@mui/system";
+import { appName } from "ente-base/app";
import { basename } from "ente-base/file-name";
import { t } from "i18next";
import { useState } from "react";
@@ -160,7 +161,7 @@ export function UploadProgressDetails() {
{t("failed_uploads_hint")}
</Typography>
)}
- <Box sx={uploadRowsSx(isDone)} data-custom-scrollbar>
+ <Box sx={uploadRowsSx(isDone)}>
{activeStat == "inProgress" ? (
inProgressUploads.length ? (
inProgressUploads.map(
@@ -375,23 +376,25 @@ const uploadRowsSx =
minHeight: minRowsListHeight,
maxHeight: isDone ? doneRowsListHeight : maxRowsListHeight,
overflowY: "auto",
- "&, & .upload-file-list": {
- scrollbarWidth: "thin",
- scrollbarColor: "rgba(0 0 0 / 0.2) transparent",
- },
- "&::-webkit-scrollbar, & .upload-file-list::-webkit-scrollbar": {
- width: 6,
- },
- "&::-webkit-scrollbar-track, & .upload-file-list::-webkit-scrollbar-track":
- { background: "transparent" },
- "&::-webkit-scrollbar-thumb, & .upload-file-list::-webkit-scrollbar-thumb":
- { borderRadius: "8px", backgroundColor: "rgba(0 0 0 / 0.2)" },
- ...theme.applyStyles("dark", {
+ ...(appName !== "photos" && {
"&, & .upload-file-list": {
- scrollbarColor: "rgba(255 255 255 / 0.2) transparent",
+ scrollbarWidth: "thin",
+ scrollbarColor: "rgba(0 0 0 / 0.2) transparent",
},
+ "&::-webkit-scrollbar, & .upload-file-list::-webkit-scrollbar": {
+ width: 6,
+ },
+ "&::-webkit-scrollbar-track, & .upload-file-list::-webkit-scrollbar-track":
+ { background: "transparent" },
"&::-webkit-scrollbar-thumb, & .upload-file-list::-webkit-scrollbar-thumb":
- { backgroundColor: "rgba(255 255 255 / 0.2)" },
+ { borderRadius: "8px", backgroundColor: "rgba(0 0 0 / 0.2)" },
+ ...theme.applyStyles("dark", {
+ "&, & .upload-file-list": {
+ scrollbarColor: "rgba(255 255 255 / 0.2) transparent",
+ },
+ "&::-webkit-scrollbar-thumb, & .upload-file-list::-webkit-scrollbar-thumb":
+ { backgroundColor: "rgba(255 255 255 / 0.2)" },
+ }),
}),
});
const failedUploadsHintSx = { mt: 2, px: 1.5, ...mutedCaptionSx };
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index 5d197aa696..ba02314e00 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -12,6 +12,7 @@ import {
TextField,
Typography,
} from "@mui/material";
+import { appName } from "ente-base/app";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import log from "ente-base/log";
import {
@@ -1150,10 +1151,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
</CloseButton>
</Header>
- <CommentsContainer
- ref={commentsContainerRef}
- data-custom-scrollbar
- >
+ <CommentsContainer ref={commentsContainerRef}>
{loading ? (
<LoadingContainer>
<CircularProgress size={32} />
@@ -1459,7 +1457,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
</ReplyingToContent>
</ReplyingToBar>
)}
- <InputWrapper data-custom-scrollbar>
+ <InputWrapper>
<StyledTextField
fullWidth
multiline
@@ -1660,19 +1658,21 @@ const CommentsContainer = styled(Box)(({ theme }) => ({
position: "relative",
display: "flex",
flexDirection: "column-reverse",
- "&::-webkit-scrollbar": { width: "6px" },
- "&::-webkit-scrollbar-track": { background: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- background: "rgba(0, 0, 0, 0.2)",
- borderRadius: "3px",
- },
- scrollbarWidth: "thin",
- scrollbarColor: "rgba(0, 0, 0, 0.2) transparent",
- ...theme.applyStyles("dark", {
+ ...(appName !== "photos" && {
+ "&::-webkit-scrollbar": { width: "6px" },
+ "&::-webkit-scrollbar-track": { background: "transparent" },
"&::-webkit-scrollbar-thumb": {
- background: "rgba(255, 255, 255, 0.2)",
+ background: "rgba(0, 0, 0, 0.2)",
+ borderRadius: "3px",
},
- scrollbarColor: "rgba(255, 255, 255, 0.2) transparent",
+ scrollbarWidth: "thin",
+ scrollbarColor: "rgba(0, 0, 0, 0.2) transparent",
+ ...theme.applyStyles("dark", {
+ "&::-webkit-scrollbar-thumb": {
+ background: "rgba(255, 255, 255, 0.2)",
+ },
+ scrollbarColor: "rgba(255, 255, 255, 0.2) transparent",
+ }),
}),
}));
@@ -1802,23 +1802,27 @@ const InputWrapper = styled(Box)(({ theme }) => ({
padding: "8px 48px 8px 16px",
maxHeight: "300px",
overflow: "auto",
- "&::-webkit-scrollbar": { width: "8px" },
- "&::-webkit-scrollbar-track": { background: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- background: "rgba(0, 0, 0, 0.3)",
- borderRadius: "4px",
- },
- "&::-webkit-scrollbar-thumb:hover": { background: "rgba(0, 0, 0, 0.5)" },
- scrollbarWidth: "thin",
- scrollbarColor: "rgba(0, 0, 0, 0.3) transparent",
- ...theme.applyStyles("dark", {
+ ...(appName !== "photos" && {
+ "&::-webkit-scrollbar": { width: "8px" },
+ "&::-webkit-scrollbar-track": { background: "transparent" },
"&::-webkit-scrollbar-thumb": {
- background: "rgba(255, 255, 255, 0.3)",
+ background: "rgba(0, 0, 0, 0.3)",
+ borderRadius: "4px",
},
"&::-webkit-scrollbar-thumb:hover": {
- background: "rgba(255, 255, 255, 0.5)",
+ background: "rgba(0, 0, 0, 0.5)",
},
- scrollbarColor: "rgba(255, 255, 255, 0.3) transparent",
+ scrollbarWidth: "thin",
+ scrollbarColor: "rgba(0, 0, 0, 0.3) transparent",
+ ...theme.applyStyles("dark", {
+ "&::-webkit-scrollbar-thumb": {
+ background: "rgba(255, 255, 255, 0.3)",
+ },
+ "&::-webkit-scrollbar-thumb:hover": {
+ background: "rgba(255, 255, 255, 0.5)",
+ },
+ scrollbarColor: "rgba(255, 255, 255, 0.3) transparent",
+ }),
}),
}));
diff --git a/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx b/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
index f8ee4d4de8..b896dd2e76 100644
--- a/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
+++ b/web/packages/gallery/components/viewer/LikeAlbumSelectorModal.tsx
@@ -1,5 +1,6 @@
import CloseIcon from "@mui/icons-material/Close";
import { Box, Dialog, IconButton, styled, Typography } from "@mui/material";
+import { appName } from "ente-base/app";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import { t } from "i18next";
import React from "react";
@@ -192,7 +193,7 @@ export const LikeAlbumSelectorModal: React.FC<LikeAlbumSelectorModalProps> = ({
</LikeAllButton>
</AlbumsHeader>
- <AlbumsList data-custom-scrollbar>
+ <AlbumsList>
{albums.map((album) => {
const isLiked = likedAlbumIDs.has(album.id);
return (
@@ -352,16 +353,18 @@ const AlbumsList = styled(Box)(({ theme }) => ({
padding: "0 12px 12px 12px",
overflowY: "auto",
maxHeight: 241,
- "&::-webkit-scrollbar": { width: 6 },
- "&::-webkit-scrollbar-track": { background: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- background: "rgba(0, 0, 0, 0.2)",
- borderRadius: 3,
- },
- ...theme.applyStyles("dark", {
+ ...(appName !== "photos" && {
+ "&::-webkit-scrollbar": { width: 6 },
+ "&::-webkit-scrollbar-track": { background: "transparent" },
"&::-webkit-scrollbar-thumb": {
- background: "rgba(255, 255, 255, 0.2)",
+ background: "rgba(0, 0, 0, 0.2)",
+ borderRadius: 3,
},
+ ...theme.applyStyles("dark", {
+ "&::-webkit-scrollbar-thumb": {
+ background: "rgba(255, 255, 255, 0.2)",
+ },
+ }),
}),
}));
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index ecdbdd157c..b580497d16 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -9,6 +9,7 @@ import {
styled,
Typography,
} from "@mui/material";
+import { appName } from "ente-base/app";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import log from "ente-base/log";
import { useResolvedContactAvatar } from "ente-contacts";
@@ -549,7 +550,7 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
</CloseButton>
</Header>
- <LikersContainer data-custom-scrollbar>
+ <LikersContainer>
{loading ? (
<LoadingContainer>
<CircularProgress size={32} />
@@ -713,19 +714,21 @@ const LikersContainer = styled(Box)(({ theme }) => ({
overflow: "auto",
marginRight: -24,
paddingRight: 24,
- "&::-webkit-scrollbar": { width: "6px" },
- "&::-webkit-scrollbar-track": { background: "transparent" },
- "&::-webkit-scrollbar-thumb": {
- background: "rgba(0, 0, 0, 0.2)",
- borderRadius: "3px",
- },
- scrollbarWidth: "thin",
- scrollbarColor: "rgba(0, 0, 0, 0.2) transparent",
- ...theme.applyStyles("dark", {
+ ...(appName !== "photos" && {
+ "&::-webkit-scrollbar": { width: "6px" },
+ "&::-webkit-scrollbar-track": { background: "transparent" },
"&::-webkit-scrollbar-thumb": {
- background: "rgba(255, 255, 255, 0.2)",
+ background: "rgba(0, 0, 0, 0.2)",
+ borderRadius: "3px",
},
- scrollbarColor: "rgba(255, 255, 255, 0.2) transparent",
+ scrollbarWidth: "thin",
+ scrollbarColor: "rgba(0, 0, 0, 0.2) transparent",
+ ...theme.applyStyles("dark", {
+ "&::-webkit-scrollbar-thumb": {
+ background: "rgba(255, 255, 255, 0.2)",
+ },
+ scrollbarColor: "rgba(255, 255, 255, 0.2) transparent",
+ }),
}),
}));