Skip to content

Commit

Permalink
fixed floating copy button and position it on top of code block
Browse files Browse the repository at this point in the history
  • Loading branch information
somebodyawesome-dev committed Jun 26, 2024
1 parent fff5780 commit 4e2406b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions packages/css/themes/src/common/components/Message.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
font-size: var(--nlux-cdBlk--ftSz);

position: relative;
overflow: scroll;
padding: 10px 0;
max-width: 100%;

color: var(--nlux-cdBlk--txtClr);
border: var(--nlux-cdBlk--brdrWd) solid var(--nlux-cdBlk--brdClr);
Expand All @@ -40,7 +39,9 @@
}

> .code-block > pre {
width: fit-content;
overflow: auto;
padding: 10px 0;
width: 100%;
min-width: 100%;
}

Expand All @@ -53,7 +54,9 @@
}

button.nlux-comp-copyButton {
position: relative;
position: absolute;
top:5px;
right:0;
z-index: 888888;
width: var(--nlux-cdBlk-cpBtn--wd);

Expand All @@ -62,7 +65,7 @@
margin-left: auto;

padding: var(--nlux-cdBlk-cpBtn--pdng);

cursor: pointer;
color: var(--nlux-cdBlk-cpBtn--txtClr);
border: var(--nlux-cdBlk-cpBtn--brdrWd) solid var(--nlux-cdBlk-cpBtn--brdClr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export const insertCopyToClipboardButton = (markdownContainer: HTMLElement) => {
copyIcon.classList.add('icon-copy');
copyButton.appendChild(copyIcon);

codeBlockContainer.insertAdjacentElement('beforebegin', copyButton);
codeBlockContainer.appendChild(copyButton);
});
};

0 comments on commit 4e2406b

Please sign in to comment.