diff options
author | Sascha <GlancingMind@outlook.com> | 2021-03-30 16:25:44 +0200 |
---|---|---|
committer | Sascha <GlancingMind@outlook.com> | 2021-04-08 14:57:39 +0200 |
commit | 4d4172bb4c7bac5f801ef67f60ff9c58021d3080 (patch) | |
tree | c091ebbd1b6220c0467ab9a32e0577f2068f0127 /webui/src/components | |
parent | f5df854def95e35e6fc2b408ecf746dcc0a8d38a (diff) | |
download | git-bug-4d4172bb4c7bac5f801ef67f60ff9c58021d3080.tar.gz |
Cut of very long labels with an ellipse
Diffstat (limited to 'webui/src/components')
-rw-r--r-- | webui/src/components/Label.tsx | 12 |
1 files changed, 8 insertions, 4 deletions
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 ( <Chip size={'small'} label={label.name} - style={createStyle(label.color)} + style={createStyle(label.color, maxWidth)} ></Chip> ); } |