From d18765a613b45c2c6dc9956b4fbf23dbc3f71236 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 7 Mar 2023 19:32:29 +0530 Subject: [PATCH] style: truncate (#388) * style: truncate * fix: truncate text added to cycle and module card --- .../components/cycles/single-cycle-card.tsx | 4 +- .../components/modules/single-module-card.tsx | 65 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/apps/app/components/cycles/single-cycle-card.tsx b/apps/app/components/cycles/single-cycle-card.tsx index f5591a737..967b0641e 100644 --- a/apps/app/components/cycles/single-cycle-card.tsx +++ b/apps/app/components/cycles/single-cycle-card.tsx @@ -19,7 +19,7 @@ import { ChevronDownIcon, PencilIcon, StarIcon } from "@heroicons/react/24/outli // helpers import { getDateRangeStatus, renderShortDateWithYearFormat } from "helpers/date-time.helper"; import { groupBy } from "helpers/array.helper"; -import { capitalizeFirstLetter, copyTextToClipboard } from "helpers/string.helper"; +import { capitalizeFirstLetter, copyTextToClipboard, truncateText } from "helpers/string.helper"; // types import { CompletedCyclesResponse, @@ -235,7 +235,7 @@ export const SingleCycleCard: React.FC = (props) => {
-

{cycle.name}

+

{truncateText(cycle.name,75)}

{cycle.is_favorite ? ( diff --git a/apps/app/components/modules/single-module-card.tsx b/apps/app/components/modules/single-module-card.tsx index 3526321e8..c8b179ae5 100644 --- a/apps/app/components/modules/single-module-card.tsx +++ b/apps/app/components/modules/single-module-card.tsx @@ -10,7 +10,7 @@ import useToast from "hooks/use-toast"; // components import { DeleteModuleModal } from "components/modules"; // ui -import { AssigneesList, Avatar, CustomMenu } from "components/ui"; +import { AssigneesList, Avatar, CustomMenu, Tooltip } from "components/ui"; // icons import User from "public/user.png"; import { @@ -32,7 +32,7 @@ import { IModule } from "types"; // fetch-key import { MODULE_LIST, STATE_LIST } from "constants/fetch-keys"; // helper -import { copyTextToClipboard } from "helpers/string.helper"; +import { copyTextToClipboard, truncateText } from "helpers/string.helper"; import { getStatesList } from "helpers/state.helper"; type Props = { @@ -162,7 +162,7 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule }) setIsOpen={setModuleDeleteModal} data={module} /> -
+
= ({ module, handleEditModule }) }} />
-
- - - {module.name} - - +
+ + + + {truncateText(module.name, 75)} + + +
@@ -242,30 +246,25 @@ export const SingleModuleCard: React.FC = ({ module, handleEditModule }) {module?.status?.replace("-", " ")}
- - {module.is_favorite ? ( - - ) : ( - - )} - - - - - Edit module - - - Delete module - - - Copy module link - - - + {module.is_favorite ? ( + + ) : ( + + )} + + + Edit module + + Delete module + + + Copy module link + +