Truncate control name in sidebar

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-03-28 18:03:02 +04:00
parent b9e2c9e051
commit 0fcffdfc99

View File

@@ -3,6 +3,8 @@ import { ControlList_List$key } from "./__generated__/ControlList_List.graphql";
import { NavLink, useParams } from "react-router";
import { cn } from "@/lib/utils";
const maxControlNameLength = 80;
export const controlListFragment = graphql`
fragment ControlList_List on Framework {
controls(first: 100, orderBy: { field: CREATED_AT, direction: ASC })
@@ -68,7 +70,9 @@ export function ControlList(props: ControlListProps) {
isActive && "font-medium"
)}
>
{control.name}
{control.name.length > maxControlNameLength
? `${control.name.slice(0, maxControlNameLength - 2)}…`
: control.name}
</div>
</>
);