diff --git a/gradle/changelog/source-copy-and-markdown-toggle.yaml b/gradle/changelog/source-copy-and-markdown-toggle.yaml new file mode 100644 index 0000000000..8d76c64618 --- /dev/null +++ b/gradle/changelog/source-copy-and-markdown-toggle.yaml @@ -0,0 +1,4 @@ +- type: changed + description: Only display source code copy button on hover ([#1939](https://github.com/scm-manager/scm-manager/pull/1939)) +- type: fixed + description: Markdown toggle covers source copy button ([#1939](https://github.com/scm-manager/scm-manager/pull/1939)) diff --git a/scm-ui/ui-components/src/SyntaxHighlighter.tsx b/scm-ui/ui-components/src/SyntaxHighlighter.tsx index 23831de209..4c95636339 100644 --- a/scm-ui/ui-components/src/SyntaxHighlighter.tsx +++ b/scm-ui/ui-components/src/SyntaxHighlighter.tsx @@ -37,15 +37,20 @@ import copyToClipboard from "./CopyToClipboard"; const LINE_NUMBER_URL_HASH_REGEX = /^#line-(.*)$/; -const Container = styled.div` - position: relative; -`; const TopRightButton = styled.button` position: absolute; + display: none; top: 0; right: 0; `; +const Container = styled.div` + position: relative; + &:hover > ${TopRightButton} { + display: inline-block; + } +`; + type Props = { language?: string; value: string; 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 876ccde558..308d3681a2 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -4614,7 +4614,7 @@ exports[`Storyshots MarkdownView Code without Lang 1`] = `