aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-03-30 16:25:44 +0200
committerSascha <GlancingMind@outlook.com>2021-04-08 14:57:39 +0200
commit4d4172bb4c7bac5f801ef67f60ff9c58021d3080 (patch)
treec091ebbd1b6220c0467ab9a32e0577f2068f0127 /webui/src/components
parentf5df854def95e35e6fc2b408ecf746dcc0a8d38a (diff)
downloadgit-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.tsx12
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>
);
}