From c37d3d771806f9709c0c9fc77b5bbf8806a2ec23 Mon Sep 17 00:00:00 2001 From: Sascha Date: Thu, 8 Apr 2021 18:02:33 +0200 Subject: [PATCH] Fix label alignment to title on bug list page Also add className support for custom label component. This allows to set the margin of an label where the label is used instead of defining a fixed margin in the label component. --- webui/src/components/Label.tsx | 7 +++-- webui/src/pages/bug/Bug.tsx | 2 ++ webui/src/pages/bug/LabelChange.tsx | 9 ++++-- webui/src/pages/list/BugRow.tsx | 44 ++++++++++++++++++----------- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/webui/src/components/Label.tsx b/webui/src/components/Label.tsx index e719eee05a08ff33310c4a4544559f81493e926f..a1d3c6f9dce60b2dab3857220ba251966057411b 100644 --- a/webui/src/components/Label.tsx +++ b/webui/src/components/Label.tsx @@ -26,21 +26,22 @@ 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; maxWidth?: string; + className?: string; }; -function Label({ label, maxWidth }: Props) { +function Label({ label, maxWidth, className }: Props) { return ( + /> ); } export default Label; diff --git a/webui/src/pages/bug/Bug.tsx b/webui/src/pages/bug/Bug.tsx index 5f3dfd035fe03f152c472da0a9a81d62c0fd52e7..b32b094845f24be2f0c8788a94649b1891be38df 100644 --- a/webui/src/pages/bug/Bug.tsx +++ b/webui/src/pages/bug/Bug.tsx @@ -61,6 +61,8 @@ const useStyles = makeStyles((theme) => ({ label: { marginTop: theme.spacing(0.1), marginBottom: theme.spacing(0.1), + marginLeft: theme.spacing(0.25), + marginRight: theme.spacing(0.25), }, noLabel: { ...theme.typography.body2, diff --git a/webui/src/pages/bug/LabelChange.tsx b/webui/src/pages/bug/LabelChange.tsx index fd466ab88fc34c4191a4bbf86c53f66fa4b6dbb0..712c33fabdb2280baca87170027e0c054ff2edb2 100644 --- a/webui/src/pages/bug/LabelChange.tsx +++ b/webui/src/pages/bug/LabelChange.tsx @@ -16,6 +16,11 @@ const useStyles = makeStyles((theme) => ({ author: { fontWeight: 'bold', }, + label: { + maxWidth: '50ch', + marginLeft: theme.spacing(0.25), + marginRight: theme.spacing(0.25), + }, })); type Props = { @@ -30,12 +35,12 @@ function LabelChange({ op }: Props) { {added.length > 0 && added the } {added.map((label, index) => ( -