fix: Show max 3 lines of content on notification items

This commit is contained in:
Tom Moor
2023-07-14 21:51:15 -04:00
parent 5dcd7a74ca
commit ea07b72c7a
2 changed files with 16 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ import { s } from "@shared/styles";
import Notification from "~/models/Notification";
import CommentEditor from "~/scenes/Document/components/CommentEditor";
import useStores from "~/hooks/useStores";
import { hover } from "~/styles";
import { hover, truncateMultiline } from "~/styles";
import Avatar from "../Avatar";
import { AvatarSize } from "../Avatar/Avatar";
import Flex from "../Flex";
@@ -76,6 +76,8 @@ function NotificationListItem({ notification, onNavigate }: Props) {
const StyledCommentEditor = styled(CommentEditor)`
font-size: 0.9em;
margin-top: 4px;
${truncateMultiline(3)}
`;
const StyledAvatar = styled(Avatar)`

View File

@@ -38,3 +38,16 @@ export const fadeOnDesktopBackgrounded = () => {
body.backgrounded & { opacity: 0.75; }
`;
};
/**
* Truncate multiline text.
*
* @returns string of CSS
*/
export const truncateMultiline = (lines: number) => `
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: ${lines};
overflow: hidden;
overflow-wrap: anywhere;
`;