Skip to content

armgit / ente

Public Imported from GitHub
0

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

2 line

Manav Rathidafbf23d67fc
diff --git a/web/packages/base/components/Typography.tsx b/web/packages/base/components/Typography.tsx
index 518bef28fb..9fa71e7b73 100644
--- a/web/packages/base/components/Typography.tsx
+++ b/web/packages/base/components/Typography.tsx
@@ -14,8 +14,24 @@ export const EllipsizedTypography = styled(Typography)`
hidden instead. */
overflow: hidden;
/* Specify handling of text when it overflows, asking the browser to insert
- ellipsis instead of clipping. */
+ ellipsis instead of clipping.
+
+ Note that both overflow and text-overflow are required.
+ */
text-overflow: ellipsis;
/* Don't automatically wrap the text by inserting line breaks. */
white-space: nowrap;
`;
+
+/**
+ * A variant of {@link EllipsizedTypography} that takes up to 2 lines.
+ */
+export const Ellipsized2LineTypography = styled(Typography)`
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2; /* number of lines to show */
+ line-clamp: 2;
+ -webkit-box-orient: vertical;
+ word-break: break-word;
+`;
diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsx
index 43ca6853ef..5606758559 100644
--- a/web/packages/new/photos/components/gallery/BarImpl.tsx
+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx
@@ -1,5 +1,6 @@
import { FilledIconButton } from "@/base/components/mui";
import { Overlay } from "@/base/components/mui/Container";
+import { Ellipsized2LineTypography } from "@/base/components/Typography";
import { useIsSmallWidth } from "@/base/components/utils/hooks";
import { CollectionsSortOptions } from "@/new/photos/components/CollectionsSortOptions";
import {
@@ -508,21 +509,13 @@ const CollectionBarCard: React.FC<CollectionBarCardProps> = ({
const CardText: React.FC<React.PropsWithChildren> = ({ children }) => (
<TileTextOverlay>
<Box height={"2.1em"}>
- <Ellipsized variant="small">{children}</Ellipsized>
+ <Ellipsized2LineTypography variant="small">
+ {children}
+ </Ellipsized2LineTypography>
</Box>
</TileTextOverlay>
);
-const Ellipsized = styled(Typography)`
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2; // number of lines to show
- line-clamp: 2;
- -webkit-box-orient: vertical;
- word-break: break-word;
-`;
-
interface CollectionBarCardIconProps {
type: CollectionSummaryType;
}
diff --git a/web/packages/new/photos/pages/duplicates.tsx b/web/packages/new/photos/pages/duplicates.tsx
index 28fb704b07..5b476065a0 100644
--- a/web/packages/new/photos/pages/duplicates.tsx
+++ b/web/packages/new/photos/pages/duplicates.tsx
@@ -7,6 +7,7 @@ import {
OverflowMenu,
OverflowMenuOption,
} from "@/base/components/OverflowMenu";
+import { Ellipsized2LineTypography } from "@/base/components/Typography";
import { pt } from "@/base/i18n";
import log from "@/base/log";
import { formattedByteSize } from "@/new/photos/utils/units";
@@ -511,7 +512,9 @@ const ListItem: React.FC<ListChildComponentProps<DuplicatesListItemData>> =
coverFile={item.file}
>
<DuplicateTileTextOverlay>
- <Typography color="text.muted">{item.collectionName}</Typography>
+ <Ellipsized2LineTypography color="text.muted">
+ {item.collectionName}
+ </Ellipsized2LineTypography>
</DuplicateTileTextOverlay>
</ItemCard>
))}