Skip to content

Commit ac135bb

Browse files
github-actions[bot]RoyLee1224bbovenzi
authored
[v3-1-test] feat: make clipboard hover (#56382) (#56484)
(cherry picked from commit 0dca308) Co-authored-by: LI,JHE-CHEN <103923510+RoyLee1224@users.noreply.github.com> Co-authored-by: Brent Bovenzi <brent@astronomer.io>
1 parent c4a4b02 commit ac135bb

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

airflow-core/src/airflow/ui/src/pages/TaskInstance/RenderedTemplates.tsx

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { Box, HStack, Table } from "@chakra-ui/react";
19+
import { Box, Table } from "@chakra-ui/react";
2020
import { useParams } from "react-router-dom";
2121
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
2222
import bash from "react-syntax-highlighter/dist/esm/languages/prism/bash";
@@ -61,24 +61,37 @@ export const RenderedTemplates = () => {
6161
<Table.Row key={key}>
6262
<Table.Cell>{key}</Table.Cell>
6363
<Table.Cell>
64-
<HStack alignItems="flex-start">
65-
<Box flex="1">
66-
<Box as="pre" borderRadius="md" fontSize="sm" m={0} overflowX="auto" p={2}>
67-
<SyntaxHighlighter
68-
language={language}
69-
PreTag="div" // Prevents double <pre> nesting
70-
showLineNumbers
71-
style={style}
72-
wrapLongLines
73-
>
74-
{renderedValue}
75-
</SyntaxHighlighter>
76-
</Box>
64+
<Box
65+
css={{
66+
"&:hover .copy-button": {
67+
opacity: 1,
68+
},
69+
}}
70+
>
71+
<Box as="pre" borderRadius="md" fontSize="sm" m={0} overflowX="auto" p={2}>
72+
<SyntaxHighlighter
73+
language={language}
74+
PreTag="div" // Prevents double <pre> nesting
75+
showLineNumbers
76+
style={style}
77+
wrapLongLines
78+
>
79+
{renderedValue}
80+
</SyntaxHighlighter>
7781
</Box>
78-
<ClipboardRoot value={renderedValue}>
82+
<ClipboardRoot
83+
className="copy-button"
84+
float="right"
85+
marginTop="-3.5rem"
86+
opacity={0}
87+
position="sticky"
88+
right={4}
89+
transition="opacity 0.2s ease-in-out"
90+
value={renderedValue}
91+
>
7992
<ClipboardIconButton />
8093
</ClipboardRoot>
81-
</HStack>
94+
</Box>
8295
</Table.Cell>
8396
</Table.Row>
8497
);

0 commit comments

Comments
 (0)