From 6b276afb3b49b6e25b027660ecab66177e9bf47a Mon Sep 17 00:00:00 2001
From: Phil-Ah
Date: Thu, 9 Jun 2022 07:49:49 +0200
Subject: [PATCH] Icons in buttons are encapsulated in span to avoid
text-decoration (#2065)
The is-text css-class adds an underline to text in buttons. To avoid icons from receiving this underline they will be encapsulated in a span.
---
.../remove_underline_from_icon_button.yaml | 2 +
.../src/__snapshots__/storyshots.test.ts.snap | 1252 ++++++++++-------
scm-ui/ui-components/src/buttons/Button.tsx | 4 +-
3 files changed, 744 insertions(+), 514 deletions(-)
create mode 100644 gradle/changelog/remove_underline_from_icon_button.yaml
diff --git a/gradle/changelog/remove_underline_from_icon_button.yaml b/gradle/changelog/remove_underline_from_icon_button.yaml
new file mode 100644
index 0000000000..e050724112
--- /dev/null
+++ b/gradle/changelog/remove_underline_from_icon_button.yaml
@@ -0,0 +1,2 @@
+- type: fixed
+ description: remove underline under icon in buttons with class is-text ([#2065](https://github.com/scm-manager/scm-manager/pull/2065))
diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
index 92dd75efee..56ae2b057c 100644
--- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
+++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
@@ -552,13 +552,15 @@ exports[`Storyshots Buttons/AddButton Default 1`] = `
onClick={[Function]}
type="button"
>
-
-
-
- Add
+
+
+
+
+ Add
+
`;
@@ -573,9 +575,11 @@ exports[`Storyshots Buttons/Button Colors 1`] = `
onClick={[Function]}
type="button"
>
-
- primary
-
+
+
+ primary
+
+
-
- link
-
+
+
+ link
+
+
-
- info
-
+
+
+ info
+
+
-
- success
-
+
+
+ success
+
+
-
- warning
-
+
+
+ warning
+
+
-
- danger
-
+
+
+ danger
+
+
-
- white
-
+
+
+ white
+
+
-
- light
-
+
+
+ light
+
+
-
- dark
-
+
+
+ dark
+
+
-
- black
-
+
+
+ black
+
+
-
- text
-
+
+
+ text
+
+
@@ -722,9 +746,11 @@ exports[`Storyshots Buttons/Button Disabled 1`] = `
onClick={[Function]}
type="button"
>
-
- primary
-
+
+
+ primary
+
+
-
- link
-
+
+
+ link
+
+
-
- info
-
+
+
+ info
+
+
-
- success
-
+
+
+ success
+
+
-
- warning
-
+
+
+ warning
+
+
-
- danger
-
+
+
+ danger
+
+
-
- white
-
+
+
+ white
+
+
-
- light
-
+
+
+ light
+
+
-
- dark
-
+
+
+ dark
+
+
-
- black
-
+
+
+ black
+
+
-
- text
-
+
+
+ text
+
+
@@ -879,9 +925,11 @@ exports[`Storyshots Buttons/Button Loading 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Loading Button
+
+
+
+ Loading Button
+
`;
@@ -898,9 +946,11 @@ exports[`Storyshots Buttons/CreateButton Default 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Create
+
+
+
+ Create
+
@@ -915,13 +965,15 @@ exports[`Storyshots Buttons/DeleteButton Default 1`] = `
onClick={[Function]}
type="button"
>
-
-
-
- Delete
+
+
+
+
+ Delete
+
`;
@@ -983,9 +1035,11 @@ exports[`Storyshots Buttons/EditButton Default 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Edit
+
+
+
+ Edit
+
`;
@@ -1000,9 +1054,11 @@ exports[`Storyshots Buttons/SubmitButton Default 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
`;
@@ -2133,13 +2189,15 @@ exports[`Storyshots Forms/AddKeyValueEntryToTableField Default 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Add to Table
-
+
+
+
+ Add to Table
+
+
@@ -2214,13 +2272,15 @@ exports[`Storyshots Forms/AddKeyValueEntryToTableField Disabled 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Add to Table
-
+
+
+
+ Add to Table
+
+
@@ -2475,9 +2535,11 @@ exports[`Storyshots Forms/Checkbox ReactHookForm 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -2513,9 +2575,11 @@ Array [
onClick={[Function]}
type="button"
>
-
-
- Toggle Checkbox
+
+
+
+ Toggle Checkbox
+
,
]
`;
@@ -2787,9 +2851,11 @@ exports[`Storyshots Forms/FileInput Default 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -2875,9 +2941,11 @@ exports[`Storyshots Forms/InputField AutoFocusAndRef 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Focus First InputField
+
+
+
+ Focus First InputField
+
`;
@@ -3075,9 +3143,11 @@ exports[`Storyshots Forms/InputField React Hook Form 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -3111,9 +3181,11 @@ exports[`Storyshots Forms/InputField Ref 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Focus InputField
+
+
+
+ Focus InputField
+
`;
@@ -3353,9 +3425,11 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -3389,9 +3463,11 @@ Array [
onClick={[Function]}
type="button"
>
-
-
- Check InputField
+
+
+
+ Check InputField
+
,
]
`;
@@ -3740,9 +3816,11 @@ exports[`Storyshots Forms/Select ReactHookForm 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -3790,9 +3868,11 @@ Array [
onClick={[Function]}
type="button"
>
-
-
- Focus Select Field
+
+
+
+ Focus Select Field
+
,
"false",
]
@@ -3870,9 +3950,11 @@ Array [
onClick={[Function]}
type="button"
>
-
-
- Focus First InputField
+
+
+
+ Focus First InputField
+
,
]
`;
@@ -4144,9 +4226,11 @@ exports[`Storyshots Forms/Textarea ReactHookForm 1`] = `
onClick={[Function]}
type="submit"
>
-
-
- Submit
+
+
+
+ Submit
+
@@ -4176,9 +4260,11 @@ Array [
onClick={[Function]}
type="button"
>
-
-
- Focus InputField
+
+
+
+ Focus InputField
+
,
]
`;
@@ -4244,11 +4330,13 @@ exports[`Storyshots GroupEntry Default 1`] = `
title="Copy clone command to clipboard"
type="button"
>
-
-
+
+
+
+
@@ -4318,11 +4406,13 @@ exports[`Storyshots GroupEntry With long texts 1`] = `
title="Copy clone command to clipboard"
type="button"
>
-
-
+
+
+
+
@@ -4714,11 +4804,13 @@ exports[`Storyshots MarkdownView Code without Lang 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -6164,11 +6256,13 @@ Deserunt officia esse aliquip consectetur duis ut labore laborum commodo aliquip
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -14493,11 +14587,13 @@ exports[`Storyshots MarkdownView Inline Xml 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -16067,11 +16163,13 @@ Deserunt officia esse aliquip consectetur duis ut labore laborum commodo aliquip
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -16861,11 +16959,13 @@ exports[`Storyshots MarkdownView Xml Code Block 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -17303,9 +17403,11 @@ exports[`Storyshots Modal/Modal Nested 1`] = `
title="Open inner modal"
type="button"
>
-
-
- Open inner modal
+
+
+
+ Open inner modal
+
@@ -17467,18 +17569,22 @@ exports[`Storyshots Modal/Modal With form elements 1`] = `
onClick={[Function]}
type="button"
>
-
- One
-
+
+
+ One
+
+
@@ -17538,18 +17644,22 @@ exports[`Storyshots Modal/Modal With initial button focus 1`] = `
onClick={[Function]}
type="button"
>
-
- One
-
+
+
+ One
+
+
@@ -17623,18 +17733,22 @@ exports[`Storyshots Modal/Modal With initial input field focus 1`] = `
onClick={[Function]}
type="button"
>
-
- One
-
+
+
+ One
+
+
@@ -18187,18 +18301,22 @@ exports[`Storyshots Modal/Modal With overflow and footer 1`] = `
onClick={[Function]}
type="button"
>
-
- One
-
+
+
+ One
+
+
@@ -19293,13 +19411,15 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/b6c6f8fbd0d490936fae7d26ffdd4695cc2a0930"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -19446,13 +19568,15 @@ exports[`Storyshots Repositories/Changesets Commiter and Co-Authors with avatar
href="/repo/hitchhiker/heartOfGold/code/changeset/a88567ef1e9528a700555cad8c4576b72fc7c6dd"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -19557,13 +19683,15 @@ exports[`Storyshots Repositories/Changesets Default 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -19678,13 +19808,15 @@ exports[`Storyshots Repositories/Changesets Replacements 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/d21cc6c359270aef2196796f4d96af65f51866dc"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -19801,13 +19935,15 @@ exports[`Storyshots Repositories/Changesets With Committer 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/d21cc6c359270aef2196796f4d96af65f51866dc"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -19933,13 +20071,15 @@ exports[`Storyshots Repositories/Changesets With Committer and Co-Author 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/a88567ef1e9528a700555cad8c4576b72fc7c6dd"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20057,13 +20199,15 @@ exports[`Storyshots Repositories/Changesets With avatar 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20177,13 +20323,15 @@ exports[`Storyshots Repositories/Changesets With contactless signature 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20297,13 +20447,15 @@ exports[`Storyshots Repositories/Changesets With invalid signature 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20421,13 +20575,15 @@ exports[`Storyshots Repositories/Changesets With multiple Co-Authors 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/b6c6f8fbd0d490936fae7d26ffdd4695cc2a0930"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20541,13 +20699,15 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and invalid
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20661,13 +20823,15 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and not fou
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20781,13 +20947,15 @@ exports[`Storyshots Repositories/Changesets With multiple signatures and valid s
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -20901,13 +21071,15 @@ exports[`Storyshots Repositories/Changesets With unknown signature 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -21021,13 +21195,15 @@ exports[`Storyshots Repositories/Changesets With unowned signature 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -21141,13 +21319,15 @@ exports[`Storyshots Repositories/Changesets With valid signature 1`] = `
href="/repo/hitchhiker/heartOfGold/code/changeset/e163c8f632db571c9aa51a8eb440e37cf550b825"
onClick={[Function]}
>
-
-
- changeset.buttons.details
-
+
+
+
+ changeset.buttons.details
+
+
-
-
- changeset.buttons.sources
-
+
+
+
+ changeset.buttons.sources
+
+
@@ -21471,9 +21653,11 @@ exports[`Storyshots Repositories/Diff Changing Content 1`] = `
onClick={[Function]}
type="button"
>
-
-
- Change content
+
+
+
+ Change content
+
@@ -71962,11 +72148,13 @@ exports[`Storyshots SyntaxHighlighter Java 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -72168,11 +72356,13 @@ exports[`Storyshots SyntaxHighlighter Javascript 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -76474,11 +76664,13 @@ exports[`Storyshots SyntaxHighlighter Markdown 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -77005,11 +77197,13 @@ exports[`Storyshots SyntaxHighlighter Python 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -77222,11 +77416,13 @@ exports[`Storyshots SyntaxHighlighter Without line numbers 1`] = `
title="syntaxHighlighting.copyButton"
type="button"
>
-
-
-
+
+
+
+
+
@@ -78215,9 +78411,11 @@ exports[`Storyshots Tooltip Default 1`] = `
onClick={[Function]}
type="button"
>
-
- right
-
+
+
+ right
+
+
@@ -78236,9 +78434,11 @@ exports[`Storyshots Tooltip Default 1`] = `
onClick={[Function]}
type="button"
>
-
- top
-
+
+
+ top
+
+
@@ -78257,9 +78457,11 @@ exports[`Storyshots Tooltip Default 1`] = `
onClick={[Function]}
type="button"
>
-
- left
-
+
+
+ left
+
+
@@ -78278,9 +78480,11 @@ exports[`Storyshots Tooltip Default 1`] = `
onClick={[Function]}
type="button"
>
-
- bottom
-
+
+
+ bottom
+
+
@@ -78306,9 +78510,11 @@ exports[`Storyshots Tooltip Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- right
-
+
+
+ right
+
+
@@ -78327,9 +78533,11 @@ exports[`Storyshots Tooltip Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- top
-
+
+
+ top
+
+
@@ -78348,9 +78556,11 @@ exports[`Storyshots Tooltip Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- left
-
+
+
+ left
+
+
@@ -78369,9 +78579,11 @@ exports[`Storyshots Tooltip Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- bottom
-
+
+
+ bottom
+
+
@@ -78397,9 +78609,11 @@ exports[`Storyshots Tooltip Short Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- right
-
+
+
+ right
+
+
@@ -78418,9 +78632,11 @@ exports[`Storyshots Tooltip Short Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- top
-
+
+
+ top
+
+
@@ -78439,9 +78655,11 @@ exports[`Storyshots Tooltip Short Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- left
-
+
+
+ left
+
+
@@ -78460,9 +78678,11 @@ exports[`Storyshots Tooltip Short Multiline 1`] = `
onClick={[Function]}
type="button"
>
-
- bottom
-
+
+
+ bottom
+
+
@@ -78488,9 +78708,11 @@ exports[`Storyshots Tooltip Styled 1`] = `
onClick={[Function]}
type="button"
>
-
- right
-
+
+
+ right
+
+
@@ -78509,9 +78731,11 @@ exports[`Storyshots Tooltip Styled 1`] = `
onClick={[Function]}
type="button"
>
-
- top
-
+
+
+ top
+
+
@@ -78530,9 +78754,11 @@ exports[`Storyshots Tooltip Styled 1`] = `
onClick={[Function]}
type="button"
>
-
- left
-
+
+
+ left
+
+
@@ -78551,9 +78777,11 @@ exports[`Storyshots Tooltip Styled 1`] = `
onClick={[Function]}
type="button"
>
-
- bottom
-
+
+
+ bottom
+
+
diff --git a/scm-ui/ui-components/src/buttons/Button.tsx b/scm-ui/ui-components/src/buttons/Button.tsx
index de6e83cadc..96808aade0 100644
--- a/scm-ui/ui-components/src/buttons/Button.tsx
+++ b/scm-ui/ui-components/src/buttons/Button.tsx
@@ -89,14 +89,14 @@ const Button: FC = ({
);
const content = (
- <>
+
{renderIcon()}{" "}
{(label || children) && (
<>
{label} {children}
>
)}
- >
+
);
if (link && !disabled) {