Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(photos):move-row-card-to-v2-components

Aswin Asok0e2d811b277d
diff --git a/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx b/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
index 1ae52d39e9..2ee7570434 100644
--- a/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
+++ b/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
@@ -1,9 +1,9 @@
import { Stack } from "@mui/material";
-import { RowCard } from "ente-base/components/RowButton";
import {
TitledNestedSidebarDrawer,
type NestedSidebarDrawerVisibilityProps,
} from "ente-base/components/mui/SidebarDrawer";
+import { RowCard } from "ente-base/components/v2/RowButton";
import type { SidebarActionID } from "ente-new/photos/services/search/types";
import { t } from "i18next";
import { useRouter } from "next/router";
diff --git a/web/packages/base/components/RowButton.tsx b/web/packages/base/components/RowButton.tsx
index 415d583021..83f2882890 100644
--- a/web/packages/base/components/RowButton.tsx
+++ b/web/packages/base/components/RowButton.tsx
@@ -1,4 +1,3 @@
-import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import {
Box,
Divider,
@@ -152,63 +151,6 @@ export const RowButton: React.FC<RowButtonProps> = ({
</RowButtonRoot>
);
-interface RowCardProps {
- title: string;
- subtitle: string;
- onClick: () => void;
-}
-
-/**
- * A tappable summary card with a title, subtitle, and trailing chevron.
- * Its background appears on hover.
- */
-export const RowCard: React.FC<RowCardProps> = ({
- title,
- subtitle,
- onClick,
-}) => (
- <FocusVisibleButton
- fullWidth
- onClick={onClick}
- sx={[
- {
- p: "14px 8px 14px 0.5rem",
- gap: 1,
- justifyContent: "space-between",
- alignItems: "center",
- textAlign: "left",
- borderRadius: "10px",
- color: "text.base",
- bgcolor: "transparent",
- "&:hover": { bgcolor: "fill.faintHover" },
- "& .MuiSvgIcon-root": { fontSize: "20px", color: "text.muted" },
- },
- (theme) =>
- theme.applyStyles("dark", {
- "&:hover": { bgcolor: "backdrop.muted" },
- }),
- ]}
- >
- <Stack sx={{ minWidth: 0 }}>
- <Typography noWrap sx={{ fontWeight: "medium" }}>
- {title}
- </Typography>
- <Typography
- noWrap
- variant="small"
- sx={{
- color: "text.muted",
- lineHeight: "20px",
- fontWeight: 400,
- }}
- >
- {subtitle}
- </Typography>
- </Stack>
- <ChevronRightIcon />
- </FocusVisibleButton>
-);
-
type RowButtonRootProps = ButtonProps & {
rbVariant: RowButtonProps["variant"];
};
diff --git a/web/packages/base/components/v2/RowButton.tsx b/web/packages/base/components/v2/RowButton.tsx
new file mode 100644
index 0000000000..07223e86b4
--- /dev/null
+++ b/web/packages/base/components/v2/RowButton.tsx
@@ -0,0 +1,61 @@
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
+import { Stack, Typography } from "@mui/material";
+import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import React from "react";
+
+interface RowCardProps {
+ title: string;
+ subtitle: string;
+ onClick: () => void;
+}
+
+/**
+ * A tappable summary card with a title, subtitle, and trailing chevron.
+ * Its background appears on hover.
+ */
+export const RowCard: React.FC<RowCardProps> = ({
+ title,
+ subtitle,
+ onClick,
+}) => (
+ <FocusVisibleButton
+ fullWidth
+ onClick={onClick}
+ sx={[
+ {
+ p: "14px 8px 14px 0.5rem",
+ gap: 1,
+ justifyContent: "space-between",
+ alignItems: "center",
+ textAlign: "left",
+ borderRadius: "10px",
+ color: "text.base",
+ bgcolor: "transparent",
+ "&:hover": { bgcolor: "fill.faintHover" },
+ "& .MuiSvgIcon-root": { fontSize: "20px", color: "text.muted" },
+ },
+ (theme) =>
+ theme.applyStyles("dark", {
+ "&:hover": { bgcolor: "backdrop.muted" },
+ }),
+ ]}
+ >
+ <Stack sx={{ minWidth: 0 }}>
+ <Typography noWrap sx={{ fontWeight: "medium" }}>
+ {title}
+ </Typography>
+ <Typography
+ noWrap
+ variant="small"
+ sx={{
+ color: "text.muted",
+ lineHeight: "20px",
+ fontWeight: 400,
+ }}
+ >
+ {subtitle}
+ </Typography>
+ </Stack>
+ <ChevronRightIcon />
+ </FocusVisibleButton>
+);