From 4d4172bb4c7bac5f801ef67f60ff9c58021d3080 Mon Sep 17 00:00:00 2001 From: Sascha Date: Tue, 30 Mar 2021 16:25:44 +0200 Subject: Cut of very long labels with an ellipse --- webui/src/components/Label.tsx | 12 ++++++++---- webui/src/pages/bug/Bug.tsx | 2 +- webui/src/pages/bug/LabelChange.tsx | 4 ++-- webui/src/pages/list/BugRow.tsx | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'webui/src') diff --git a/webui/src/components/Label.tsx b/webui/src/components/Label.tsx index 13c913c9..bbe7c158 100644 --- a/webui/src/components/Label.tsx +++ b/webui/src/components/Label.tsx @@ -23,20 +23,24 @@ const getTextColor = (background: string) => : common.black; // And black on light ones // Create a style object from the label RGB colors -const createStyle = (color: Color) => ({ +const createStyle = (color: Color, maxWidth?: string) => ({ backgroundColor: _rgb(color), color: getTextColor(_rgb(color)), borderBottomColor: darken(_rgb(color), 0.2), margin: '3px', + maxWidth: maxWidth, }); -type Props = { label: LabelFragment }; -function Label({ label }: Props) { +type Props = { + label: LabelFragment; + maxWidth?: string; +}; +function Label({ label, maxWidth }: Props) { return ( ); } diff --git a/webui/src/pages/bug/Bug.tsx b/webui/src/pages/bug/Bug.tsx index 3cb48ecd..5f3dfd03 100644 --- a/webui/src/pages/bug/Bug.tsx +++ b/webui/src/pages/bug/Bug.tsx @@ -104,7 +104,7 @@ function Bug({ bug }: Props) { )} {bug.labels.map((l) => (
  • -
  • ))} diff --git a/webui/src/pages/bug/LabelChange.tsx b/webui/src/pages/bug/LabelChange.tsx index c40636c1..fd466ab8 100644 --- a/webui/src/pages/bug/LabelChange.tsx +++ b/webui/src/pages/bug/LabelChange.tsx @@ -30,12 +30,12 @@ function LabelChange({ op }: Props) { {added.length > 0 && added the } {added.map((label, index) => ( -