Skip to content

armgit / ente

Public Imported from GitHub
0

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

Match All People to the All Albums design

vijayadithyanpj08a83f9fb69f
diff --git a/desktop/changes/all-people-design.md b/desktop/changes/all-people-design.md
new file mode 100644
index 0000000000..60dbef281a
--- /dev/null
+++ b/desktop/changes/all-people-design.md
@@ -0,0 +1 @@
+- Updated All People to match the All Albums design.
diff --git a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
index ab1dbf717f..147be86fb9 100644
--- a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
+++ b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
@@ -7,9 +7,10 @@ import { t } from "i18next";
import React, { useRef } from "react";
export const CollectionDialogSearchField: React.FC<{
+ placeholder?: string;
value: string;
onChange: (value: string) => void;
-}> = ({ value, onChange }) => {
+}> = ({ value, onChange, placeholder = t("albums_search_hint") }) => {
const inputRef = useRef<HTMLInputElement>(null);
const handleClear = () => {
@@ -24,7 +25,7 @@ export const CollectionDialogSearchField: React.FC<{
inputRef={inputRef}
fullWidth
autoFocus
- placeholder={t("albums_search_hint")}
+ placeholder={placeholder}
value={value}
onChange={(e) => onChange(e.target.value)}
sx={searchInputSx}
diff --git a/web/apps/photos/src/components/Collections/AllPeople.tsx b/web/apps/photos/src/components/Collections/AllPeople.tsx
index dbd2c7c609..364b635864 100644
--- a/web/apps/photos/src/components/Collections/AllPeople.tsx
+++ b/web/apps/photos/src/components/Collections/AllPeople.tsx
@@ -1,3 +1,20 @@
+import {
+ CollectionTileButton,
+ CollectionTileTextOverlay,
+ CollectionDialogSearchField as SearchField,
+} from "@/components/CollectionDialog/Primitives";
+import {
+ collectionDialogBodyMutedSx,
+ collectionDialogDividerSx,
+ collectionDialogFullScreenQuery,
+ collectionDialogHeaderActionsSx,
+ collectionDialogHeaderRowSx,
+ collectionDialogHeaderSx,
+ collectionDialogIconButtonSx,
+ collectionDialogNoResultsSx,
+ collectionDialogPaperSx,
+ collectionDialogTitleSx,
+} from "@/components/CollectionDialog/styles";
import { PeopleSortOptions } from "@/components/PeopleSortOptions";
import { useWrapAsyncOperation } from "@/components/utils/use-wrap-async";
import { sortPeople, type PeopleSortBy } from "@/utils/people-sort";
@@ -13,23 +30,18 @@ import HideImageOutlinedIcon from "@mui/icons-material/HideImageOutlined";
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
import PushPinIcon from "@mui/icons-material/PushPin";
import PushPinOutlinedIcon from "@mui/icons-material/PushPinOutlined";
-import SearchIcon from "@mui/icons-material/Search";
import {
Box,
Button,
Dialog,
DialogContent,
- DialogTitle,
- Divider,
- InputAdornment,
+ IconButton,
Stack,
- TextField,
Tooltip,
Typography,
styled,
useMediaQuery,
} from "@mui/material";
-import { FilledIconButton } from "ente-base/components/mui";
import { DialogCloseIconButton } from "ente-base/components/mui/DialogCloseIconButton";
import {
OverflowMenu,
@@ -60,7 +72,7 @@ import type {
} from "ente-new/photos/services/ml/people";
import { t } from "i18next";
import memoize from "memoize-one";
-import React, { useEffect, useMemo, useRef, useState } from "react";
+import React, { useEffect, useId, useMemo, useRef, useState } from "react";
import AutoSizer from "react-virtualized-auto-sizer";
import {
VariableSizeList,
@@ -87,7 +99,8 @@ export const AllPeople: React.FC<AllPeopleProps> = ({
peopleSortBy,
onChangePeopleSortBy,
}) => {
- const fullScreen = useMediaQuery("(max-width: 428px)");
+ const fullScreen = useMediaQuery(collectionDialogFullScreenQuery);
+ const titleID = useId();
const { showMiniDialog } = useBaseContext();
const [searchTerm, setSearchTerm] = useState("");
const [showingAllPeople, setShowingAllPeople] = useState(false);
@@ -181,13 +194,27 @@ export const AllPeople: React.FC<AllPeopleProps> = ({
return (
<>
- <AllPeopleDialog
+ <Dialog
{...{ open, onClose, fullScreen }}
- fullWidth
+ aria-labelledby={titleID}
+ maxWidth={false}
+ sx={{
+ "& .MuiDialog-container": { justifyContent: "flex-end" },
+ "& .MuiDialog-paper": {
+ borderRadius: "32px",
+ [`@media ${collectionDialogFullScreenQuery}`]: {
+ borderRadius: 0,
+ },
+ },
+ }}
slots={{ transition: SlideUpTransition }}
- slotProps={{ transition: { onExited: handleExited } }}
+ slotProps={{
+ paper: { sx: collectionDialogPaperSx },
+ transition: { onExited: handleExited },
+ }}
>
<Title
+ titleID={titleID}
onClose={onClose}
peopleCount={visiblePeopleCount}
totalCount={totalPeopleCount}
@@ -196,7 +223,7 @@ export const AllPeople: React.FC<AllPeopleProps> = ({
peopleSortBy={peopleSortBy}
onChangePeopleSortBy={onChangePeopleSortBy}
/>
- <Divider />
+ <Box sx={collectionDialogDividerSx} />
<AllPeopleContent
primaryPeople={primaryPeople}
expandedPeople={expandedPeople}
@@ -212,7 +239,7 @@ export const AllPeople: React.FC<AllPeopleProps> = ({
onAddName={setClusterToName}
onIgnorePerson={handleIgnorePerson}
/>
- </AllPeopleDialog>
+ </Dialog>
<SingleInputDialog
open={!!personToRename}
onClose={() => setPersonToRename(undefined)}
@@ -235,61 +262,18 @@ export const AllPeople: React.FC<AllPeopleProps> = ({
);
};
-const Column3To2Breakpoint = 559;
-const PeopleRowItemSize = 154;
+const GridColumns = 3;
+const GridGap = 8;
+const GridPaddingInline = 20;
const ShowMoreFacesButtonHeight = 56;
const ShowMoreFacesButtonVerticalGap = 16;
const ShowMoreFacesRowItemSize =
ShowMoreFacesButtonHeight + 2 * ShowMoreFacesButtonVerticalGap;
const ExpandedPeopleTopSpacing = 4;
-const PeopleListTopSpacing = 16;
const personCardShellClassName = "all-people-person-card";
-const addTopSpacing = (
- value: React.CSSProperties["top"] | React.CSSProperties["height"],
-) =>
- typeof value == "number"
- ? value + PeopleListTopSpacing
- : value
- ? `calc(${value} + ${PeopleListTopSpacing}px)`
- : undefined;
-
-const peopleListInnerStyle = (
- style: React.CSSProperties | undefined,
-): React.CSSProperties => {
- return {
- ...style,
- boxSizing: "border-box",
- position: "relative",
- height: addTopSpacing(style?.height),
- };
-};
-
-const peopleRowStyle = (style: React.CSSProperties): React.CSSProperties => {
- return { ...style, top: addTopSpacing(style.top) };
-};
-
-const PeopleListInner = React.forwardRef<
- HTMLDivElement,
- React.ComponentPropsWithoutRef<"div">
->(({ style, ...props }, ref) => (
- <div ref={ref} {...props} style={peopleListInnerStyle(style)} />
-));
-
-PeopleListInner.displayName = "PeopleListInner";
-
-const AllPeopleDialog = styled(Dialog)(({ theme }) => ({
- "& .MuiDialog-container": { justifyContent: "flex-end" },
- "& .MuiPaper-root": { maxWidth: "494px" },
- "& .MuiDialogTitle-root": { padding: theme.spacing(2) },
- "& .MuiDialogContent-root": { padding: theme.spacing(2) },
- [theme.breakpoints.down(Column3To2Breakpoint)]: {
- "& .MuiPaper-root": { width: "324px" },
- "& .MuiDialogContent-root": { padding: 6 },
- },
-}));
-
type TitleProps = {
+ titleID: string;
peopleCount: number;
totalCount: number;
searchTerm: string;
@@ -299,6 +283,7 @@ type TitleProps = {
} & Pick<AllPeopleProps, "onClose">;
const Title: React.FC<TitleProps> = ({
+ titleID,
onClose,
peopleCount,
totalCount,
@@ -307,123 +292,45 @@ const Title: React.FC<TitleProps> = ({
peopleSortBy,
onChangePeopleSortBy,
}) => (
- <DialogTitle>
- <Stack sx={{ gap: 1.5 }}>
- <Stack direction="row" sx={{ gap: 1.5 }}>
- <Stack sx={{ flex: 1 }}>
- <Box>
- <Typography variant="h5">{t("people")}</Typography>
- <Typography
- variant="small"
- sx={{ color: "text.muted", fontWeight: "regular" }}
- >
- {searchTerm
- ? `${peopleCount} / ${totalCount} ${t("people")}`
- : `${peopleCount} ${t("people")}`}
- </Typography>
- </Box>
- </Stack>
+ <Stack sx={collectionDialogHeaderSx}>
+ <Stack direction="row" sx={collectionDialogHeaderRowSx}>
+ <Stack sx={{ minWidth: 0, gap: "2px" }}>
+ <Typography
+ id={titleID}
+ component="h2"
+ sx={collectionDialogTitleSx}
+ >
+ {t("people")}
+ </Typography>
+ <Typography sx={collectionDialogBodyMutedSx}>
+ {searchTerm
+ ? `${peopleCount} / ${totalCount} ${t("people")}`
+ : `${peopleCount} ${t("people")}`}
+ </Typography>
+ </Stack>
+ <Stack direction="row" sx={collectionDialogHeaderActionsSx}>
<PeopleSortOptions
activeSortBy={peopleSortBy}
onChangeSortBy={onChangePeopleSortBy}
nestedInDialog
+ variant="v2"
/>
- <FilledIconButton onClick={onClose}>
- <CloseIcon />
- </FilledIconButton>
+ <IconButton
+ aria-label={t("close")}
+ onClick={onClose}
+ sx={collectionDialogIconButtonSx}
+ >
+ <CloseIcon sx={{ fontSize: 18 }} />
+ </IconButton>
</Stack>
- <SearchField value={searchTerm} onChange={onSearchChange} />
</Stack>
- </DialogTitle>
-);
-
-interface SearchFieldProps {
- value: string;
- onChange: (value: string) => void;
-}
-
-const SearchField: React.FC<SearchFieldProps> = ({ value, onChange }) => {
- const inputRef = useRef<HTMLInputElement>(null);
-
- useEffect(() => {
- const timeout = window.setTimeout(() => {
- inputRef.current?.focus();
- inputRef.current?.select();
- }, 0);
-
- return () => window.clearTimeout(timeout);
- }, []);
-
- const handleClear = () => {
- onChange("");
- inputRef.current?.focus();
- };
-
- return (
- <TextField
- inputRef={inputRef}
- fullWidth
- size="small"
- placeholder={`${t("people_search_hint")}...`}
- value={value}
- onChange={(e) => onChange(e.target.value)}
- autoFocus
- slotProps={{
- input: {
- startAdornment: (
- <InputAdornment position="start">
- <SearchIcon />
- </InputAdornment>
- ),
- endAdornment: value && (
- <InputAdornment
- position="end"
- sx={{ marginRight: "0 !important" }}
- >
- <CloseIcon
- fontSize="small"
- onClick={handleClear}
- sx={{
- color: "stroke.muted",
- cursor: "pointer",
- "&:hover": { color: "text.base" },
- }}
- />
- </InputAdornment>
- ),
- },
- }}
- sx={{
- "& .MuiOutlinedInput-root": {
- backgroundColor: "background.searchInput",
- borderColor: "transparent",
- "&:hover": { borderColor: "accent.light" },
- "&.Mui-focused": {
- borderColor: "accent.main",
- boxShadow: "none",
- },
- },
- "& .MuiInputBase-input": {
- color: "text.base",
- paddingTop: "8.5px !important",
- paddingBottom: "8.5px !important",
- },
- "& .MuiInputAdornment-root": {
- color: "stroke.muted",
- marginTop: "0 !important",
- marginRight: "8px",
- },
- "& .MuiOutlinedInput-notchedOutline": {
- borderColor: "transparent",
- },
- "& .MuiInputBase-input::placeholder": {
- color: "text.muted",
- opacity: 1,
- },
- }}
+ <SearchField
+ value={searchTerm}
+ onChange={onSearchChange}
+ placeholder={t("people_search_hint")}
/>
- );
-};
+ </Stack>
+);
interface AllPeopleContentProps {
primaryPeople: Person[];
@@ -453,11 +360,13 @@ interface ItemData extends Pick<
| "onAddName"
| "onIgnorePerson"
> {
+ tileSize: number;
items: PeopleListItem[];
}
const createItemData = memoize(
(
+ tileSize: number,
items: PeopleListItem[],
showingAllPeople: boolean,
onToggleShowingAllPeople: () => void,
@@ -467,6 +376,7 @@ const createItemData = memoize(
onAddName: (person: ClusterPerson) => void,
onIgnorePerson: (person: ClusterPerson) => void,
) => ({
+ tileSize,
items,
showingAllPeople,
onToggleShowingAllPeople,
@@ -494,13 +404,17 @@ const peopleListItems = (
return items;
};
-const peopleListItemSize = (item: PeopleListItem | undefined) => {
+const peopleListItemSize = (
+ item: PeopleListItem | undefined,
+ tileSize: number,
+) => {
switch (item?.type) {
case "showMoreButton":
return ShowMoreFacesRowItemSize;
default:
return (
- PeopleRowItemSize +
+ tileSize +
+ GridGap +
(item?.topSpacing ? ExpandedPeopleTopSpacing : 0)
);
}
@@ -510,6 +424,7 @@ const PeopleRow = React.memo(
({ data, index, style }: ListChildComponentProps<ItemData>) => {
const {
items,
+ tileSize,
showingAllPeople,
onToggleShowingAllPeople,
onSelectPerson,
@@ -522,7 +437,7 @@ const PeopleRow = React.memo(
if (item.type == "showMoreButton") {
return (
- <div style={peopleRowStyle(style)}>
+ <div style={style}>
<ShowMoreFacesButton
showingAllPeople={showingAllPeople}
onClick={onToggleShowingAllPeople}
@@ -532,18 +447,19 @@ const PeopleRow = React.memo(
}
return (
- <div style={peopleRowStyle(style)}>
+ <div style={style}>
<Stack
direction="row"
sx={{
boxSizing: "border-box",
height: "100%",
- px: 2,
+ "--tile-size": `${tileSize}px`,
+ px: `${GridPaddingInline}px`,
pt: item.topSpacing
? `${ExpandedPeopleTopSpacing}px`
: 0,
- pb: 0.5,
- gap: 0.5,
+ pb: `${GridGap}px`,
+ gap: `${GridGap}px`,
}}
>
{item.people.map((person) => (
@@ -577,8 +493,7 @@ const AllPeopleContent: React.FC<AllPeopleContentProps> = ({
onAddName,
onIgnorePerson,
}) => {
- const isTwoColumn = useMediaQuery(`(width < ${Column3To2Breakpoint}px)`);
- const columns = isTwoColumn ? 2 : 3;
+ const columns = GridColumns;
const listOuterRef = useRef<HTMLDivElement>(null);
const shouldShowMoreFacesButton = showMoreFacesButton && !hasSearchQuery;
@@ -617,66 +532,59 @@ const AllPeopleContent: React.FC<AllPeopleContentProps> = ({
}
};
- const itemData = createItemData(
- items,
- showingAllPeople,
- handleToggleShowingAllPeople,
- onSelectPerson,
- onRenamePerson,
- onPinPerson,
- onAddName,
- onIgnorePerson,
- );
-
if (hasSearchQuery && primaryPeople.length === 0) {
return (
- <DialogContent sx={{ height: "80svh" }}>
- <CenteredMessage>
- <Typography sx={{ color: "text.muted" }}>
- {t("no_results")}
- </Typography>
- </CenteredMessage>
- </DialogContent>
+ <Box sx={collectionDialogNoResultsSx}>
+ <Typography sx={collectionDialogBodyMutedSx}>
+ {t("no_results")}
+ </Typography>
+ </Box>
);
}
- const itemSize = (index: number) => peopleListItemSize(items[index]);
- const listContentHeight =
- PeopleListTopSpacing +
- items.reduce((height, item) => height + peopleListItemSize(item), 0);
const primaryRowCount = Math.ceil(primaryPeople.length / columns);
- const listKey = `${columns}-${shouldShowMoreFacesButton ? "with-button" : "no-button"}-${primaryRowCount}`;
+ const listKey = `${shouldShowMoreFacesButton}-${primaryRowCount}`;
return (
- <DialogContent
- sx={{
- "&&": { padding: 0 },
- height:
- hasSearchQuery || items.length === 0
- ? "80svh"
- : `min(80svh, ${listContentHeight}px)`,
- display: "flex",
- flexDirection: "column",
- }}
- >
- <Box sx={{ flex: 1, minHeight: 0 }}>
- <AutoSizer>
- {({ width, height }) => (
+ <Box sx={{ flex: 1, minHeight: 0, pt: "16px", pb: "20px" }}>
+ <AutoSizer>
+ {({ width, height }) => {
+ const tileSize = Math.max(
+ 0,
+ Math.floor(
+ (width -
+ 2 * GridPaddingInline -
+ (GridColumns - 1) * GridGap) /
+ GridColumns,
+ ),
+ );
+ return (
<VariableSizeList
{...{ width, height }}
outerRef={listOuterRef}
- key={listKey}
+ key={`${listKey}-${tileSize}`}
itemCount={items.length}
- itemSize={itemSize}
- itemData={itemData}
- innerElementType={PeopleListInner}
+ itemSize={(index) =>
+ peopleListItemSize(items[index], tileSize)
+ }
+ itemData={createItemData(
+ tileSize,
+ items,
+ showingAllPeople,
+ handleToggleShowingAllPeople,
+ onSelectPerson,
+ onRenamePerson,
+ onPinPerson,
+ onAddName,
+ onIgnorePerson,
+ )}
>
{PeopleRow}
</VariableSizeList>
- )}
- </AutoSizer>
- </Box>
- </DialogContent>
+ );
+ }}
+ </AutoSizer>
+ </Box>
);
};
@@ -689,7 +597,12 @@ const ShowMoreFacesButton: React.FC<ShowMoreFacesButtonProps> = ({
showingAllPeople,
onClick,
}) => (
- <Box sx={{ px: 2, py: `${ShowMoreFacesButtonVerticalGap}px` }}>
+ <Box
+ sx={{
+ px: `${GridPaddingInline}px`,
+ py: `${ShowMoreFacesButtonVerticalGap}px`,
+ }}
+ >
<Button
fullWidth
variant="text"
@@ -709,6 +622,7 @@ const ShowMoreFacesButton: React.FC<ShowMoreFacesButtonProps> = ({
color: "text.base",
backgroundColor: "fill.faint",
border: 0,
+ borderRadius: "16px",
height: `${ShowMoreFacesButtonHeight}px`,
minHeight: `${ShowMoreFacesButtonHeight}px`,
"&:hover": { backgroundColor: "fill.muted" },
@@ -721,13 +635,6 @@ const ShowMoreFacesButton: React.FC<ShowMoreFacesButtonProps> = ({
</Box>
);
-const CenteredMessage = styled(Box)({
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- height: "100%",
-});
-
interface PersonCardProps {
person: Person;
onSelectPerson: (id: string) => void;
@@ -747,22 +654,24 @@ const PersonCard: React.FC<PersonCardProps> = ({
}) => (
<PersonCardShell className={personCardShellClassName}>
<ItemCard
- TileComponent={LargeTileButton}
+ TileComponent={CollectionTileButton}
coverFile={person.displayFaceFile}
coverFaceID={person.displayFaceID}
onClick={() => onSelectPerson(person.id)}
>
- <LargeTileTextOverlay>
+ <CollectionTileTextOverlay>
{person.name && (
<Tooltip title={person.name} arrow>
<Typography
- variant="body"
sx={{
- maxWidth: "118px",
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 500,
+ paddingRight: "18px",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
- WebkitLineClamp: 2,
+ WebkitLineClamp: 3,
WebkitBoxOrient: "vertical",
}}
>
@@ -770,10 +679,17 @@ const PersonCard: React.FC<PersonCardProps> = ({
</Typography>
</Tooltip>
)}
- <Typography variant="small" sx={{ opacity: 0.7 }}>
+ <Typography
+ sx={{
+ fontSize: 12,
+ lineHeight: "16px",
+ fontWeight: 500,
+ opacity: 0.7,
+ }}
+ >
{t("photos_count", { count: person.fileIDs.length })}
</Typography>
- </LargeTileTextOverlay>
+ </CollectionTileTextOverlay>
{person.isPinned && (
<PinnedIconContainer>
<PushPinIcon sx={{ fontSize: 20, color: "white" }} />
@@ -792,6 +708,9 @@ const PersonCard: React.FC<PersonCardProps> = ({
const PersonCardShell = styled("div")`
position: relative;
+ flex: none;
+ width: var(--tile-size);
+ height: var(--tile-size);
`;
const PinnedIconContainer = styled(Box)`
@@ -879,7 +798,37 @@ const PersonActionMenu: React.FC<PersonActionMenuProps> = ({
opacity: 0.9,
"&:hover": { backgroundColor: "transparent", opacity: 1 },
}}
- menuPaperSxProps={{ minWidth: 176, width: 176 }}
+ menuPaperSxProps={(theme) => ({
+ minWidth: 238,
+ width: 238,
+ mt: "6px",
+ border: "1px solid #ececec",
+ borderRadius: "16px",
+ backgroundColor: "background.paper",
+ boxShadow: "0 4px 4px rgba(0 0 0 / 0.16)",
+ overflow: "hidden",
+ "& .MuiList-root": { p: 0.75 },
+ "& .MuiMenuItem-root": {
+ minHeight: 40,
+ height: 40,
+ boxSizing: "border-box",
+ py: "10px",
+ px: "12px",
+ borderRadius: "8px",
+ color: "text.base",
+ "&:hover": { backgroundColor: "fill.faintHover" },
+ },
+ "& .MuiTypography-root": {
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 500,
+ },
+ ...theme.applyStyles("dark", {
+ borderColor: "rgba(255 255 255 / 0.12)",
+ backgroundColor: "#282828",
+ boxShadow: "0 4px 4px rgba(0 0 0 / 0.40)",
+ }),
+ })}
>
{menuOptions}
</OverflowMenu>
diff --git a/web/apps/photos/src/components/PeopleSortOptions.tsx b/web/apps/photos/src/components/PeopleSortOptions.tsx
index de836c38ae..ca6242a0e7 100644
--- a/web/apps/photos/src/components/PeopleSortOptions.tsx
+++ b/web/apps/photos/src/components/PeopleSortOptions.tsx
@@ -10,6 +10,7 @@ import {
styled,
type IconButtonProps,
type PaperProps,
+ type Theme,
} from "@mui/material";
import Menu, { type MenuProps } from "@mui/material/Menu";
import { t } from "i18next";
@@ -18,6 +19,7 @@ import React, { useRef, useState } from "react";
interface PeopleSortOptionsProps {
activeSortBy: PeopleSortBy;
onChangeSortBy: (by: PeopleSortBy) => void;
+ variant?: "default" | "v2";
nestedInDialog?: boolean;
transparentTriggerButtonBackground?: boolean;
}
@@ -37,6 +39,7 @@ const getPeopleSortBy = (
export const PeopleSortOptions: React.FC<PeopleSortOptionsProps> = ({
activeSortBy,
onChangeSortBy,
+ variant = "default",
nestedInDialog,
transparentTriggerButtonBackground,
}) => {
@@ -60,15 +63,20 @@ export const PeopleSortOptions: React.FC<PeopleSortOptionsProps> = ({
setAnchorEl(undefined);
};
- const triggerButtonSxProps: IconButtonProps["sx"] = [
- transparentTriggerButtonBackground
- ? {}
- : { backgroundColor: "fill.faint" },
- ];
+ const isV2 = variant === "v2";
- const menuPaperSxProps: PaperProps["sx"] | undefined = nestedInDialog
- ? { backgroundColor: "background.paper2" }
- : undefined;
+ const triggerButtonSxProps: IconButtonProps["sx"] = isV2
+ ? v2TriggerButtonSx
+ : [
+ transparentTriggerButtonBackground
+ ? {}
+ : { backgroundColor: "fill.faint" },
+ ];
+
+ const menuPaperSxProps: PaperProps["sx"] | undefined =
+ !isV2 && nestedInDialog
+ ? { backgroundColor: "background.paper2" }
+ : undefined;
return (
<>
@@ -77,12 +85,14 @@ export const PeopleSortOptions: React.FC<PeopleSortOptionsProps> = ({
aria-controls={anchorEl ? ariaID : undefined}
aria-haspopup="true"
aria-expanded={anchorEl ? "true" : undefined}
+ aria-label={isV2 ? t("sort_by") : undefined}
sx={triggerButtonSxProps}
>
- <SortIcon />
+ <SortIcon sx={isV2 ? { fontSize: 20 } : undefined} />
</IconButton>
<StyledMenu
id={ariaID}
+ sx={isV2 ? v2MenuSx : undefined}
{...(anchorEl && { anchorEl })}
open={!!anchorEl}
onClose={() => setAnchorEl(undefined)}
@@ -209,3 +219,43 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
"& .MuiListItemText-root": { margin: 0 },
"& .MuiListItemText-primary": { color: "inherit", fontSize: "inherit" },
}));
+
+const v2TriggerButtonSx = (theme: Theme) => ({
+ width: 38,
+ height: 38,
+ p: 0,
+ color: "text.base",
+ backgroundColor: "background.paper",
+ "&:hover": { backgroundColor: "fill.faintHover" },
+ ...theme.applyStyles("dark", {
+ backgroundColor: "rgba(255 255 255 / 0.12)",
+ }),
+});
+
+const v2MenuSx = (theme: Theme) => ({
+ "& .MuiPaper-root": {
+ width: 238,
+ minWidth: 238,
+ border: "1px solid #ececec",
+ borderRadius: "16px",
+ backgroundColor: "background.paper",
+ boxShadow: "0 4px 4px rgba(0 0 0 / 0.16)",
+ ...theme.applyStyles("dark", {
+ borderColor: "rgba(255 255 255 / 0.12)",
+ backgroundColor: "#282828",
+ boxShadow: "0 4px 4px rgba(0 0 0 / 0.40)",
+ }),
+ },
+ "& .MuiMenuItem-root": {
+ minHeight: 44,
+ height: 44,
+ boxSizing: "border-box",
+ py: "12px",
+ px: "16px",
+ },
+ "& .MuiTypography-root": {
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 500,
+ },
+});