mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 21:28:12 +08:00
better handle long dataset titles (#909)
* truncate middle of long title names * remove width * In the case of VERY long titles, hide overflow * align bottom of title with cellxgene * add character length global and shrink length
This commit is contained in:
@@ -41,7 +41,8 @@ class LeftSideBar extends React.Component {
|
|||||||
userSelect: "none"
|
userSelect: "none"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
cell<span
|
cell
|
||||||
|
<span
|
||||||
style={{
|
style={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
top: 1,
|
top: 1,
|
||||||
@@ -50,22 +51,32 @@ class LeftSideBar extends React.Component {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
×
|
×
|
||||||
</span>gene
|
</span>
|
||||||
|
gene
|
||||||
</span>
|
</span>
|
||||||
<div
|
<div
|
||||||
data-testid="header"
|
data-testid="header"
|
||||||
style={{
|
style={{
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
position: "relative",
|
position: "relative",
|
||||||
top: -2,
|
top: -6,
|
||||||
display: "inline-block",
|
display: "inline-block",
|
||||||
marginLeft: 7,
|
width: "190px",
|
||||||
width: 170,
|
marginLeft: "7px",
|
||||||
overflow: "hidden"
|
height: "1.1em",
|
||||||
|
overflow: "hidden",
|
||||||
|
wordBreak: "break-all"
|
||||||
}}
|
}}
|
||||||
title={datasetTitle}
|
title={datasetTitle}
|
||||||
>
|
>
|
||||||
{datasetTitle}
|
{datasetTitle.length > globals.datasetTitleMaxCharacterCount
|
||||||
|
? `${datasetTitle.substring(
|
||||||
|
0,
|
||||||
|
Math.floor(globals.datasetTitleMaxCharacterCount / 2)
|
||||||
|
)}…${datasetTitle.slice(
|
||||||
|
-Math.floor(globals.datasetTitleMaxCharacterCount / 2)
|
||||||
|
)}`
|
||||||
|
: datasetTitle}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ export const maxParagraphWidth = 600;
|
|||||||
export const cellxgeneTitleLeftPadding = 14;
|
export const cellxgeneTitleLeftPadding = 14;
|
||||||
export const cellxgeneTitleTopPadding = 7;
|
export const cellxgeneTitleTopPadding = 7;
|
||||||
|
|
||||||
|
export const datasetTitleMaxCharacterCount = 25;
|
||||||
|
|
||||||
export const maxControlsWidth = 800;
|
export const maxControlsWidth = 800;
|
||||||
|
|
||||||
export const graphMargin = { top: 20, right: 10, bottom: 30, left: 40 };
|
export const graphMargin = { top: 20, right: 10, bottom: 30, left: 40 };
|
||||||
|
|||||||
Reference in New Issue
Block a user