Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit de27fbe

Browse files
committed
fix(GroupsSideMenu): cut long names and add tooltip
1 parent b88c185 commit de27fbe

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

client/src/components/GroupsSideMenu/filters.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useState, useEffect } from "react";
22
import { List } from "react-virtualized";
33
import PT from "prop-types";
4-
import _ from "lodash";
54

65
import SearchBox from "../searchBox";
76
import Button from "../Button";
@@ -135,17 +134,6 @@ function GroupsSection({
135134
selectedItemId,
136135
loadingGroups,
137136
}) {
138-
/**
139-
* Calculates the height value of an item.
140-
* @param {Number} index index of the item to be calculated
141-
* @return {Number} row height
142-
*/
143-
function rowHeight({ index }) {
144-
return items[index].name.length <= 30
145-
? 60
146-
: 60 + (Math.floor(items[index].name.length / 30) - 1) * 20 + 20;
147-
}
148-
149137
/**
150138
* Row renderer for react-virtualized#List.
151139
* Renders each item as a row.
@@ -177,17 +165,9 @@ function GroupsSection({
177165
<List
178166
className={styles.groupsList}
179167
width={385}
180-
height={
181-
items.length > 7
182-
? 450
183-
: _.reduce(
184-
_.map(items, (item, index) => rowHeight({ index })),
185-
(a, b) => a + b,
186-
0
187-
)
188-
}
168+
height={items.length > 7 ? 450 : items.length * 66}
189169
rowCount={items.length}
190-
rowHeight={rowHeight}
170+
rowHeight={66}
191171
rowRenderer={rowRenderer}
192172
/>
193173
</div>
@@ -213,6 +193,7 @@ function SectionRow({ title, badge, selected = false, action }) {
213193
onClick={() => {
214194
action(selected);
215195
}}
196+
title={title}
216197
>
217198
<div
218199
className={

client/src/components/GroupsSideMenu/filters.module.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@
106106

107107
.sectionItemTitle {
108108
width: 280px;
109+
overflow: hidden;
110+
white-space: nowrap;
111+
text-overflow: ellipsis;
109112
color: gray2;
110-
word-break: break-all;
111113
padding-right: 12px;
112114
}
113115

0 commit comments

Comments
 (0)