Adding a CopyButton feature#537
Conversation
There was a problem hiding this comment.
Let's avoid adding the .idea folder. We can .idea to the main .gitignore file.
There was a problem hiding this comment.
Thanks for sharing @tormath1
With a couple more changes, will stash them before opening the PR for review.
|
Linking it for visibility 😊 flatcar/Flatcar#2022 |
|
Thanks a lot for the PR! The implementation needs to change a bit, currently the copy button is rendered outside of the codeblock - which does not look good in UI terms. It would be better to use a font-awesome icon and place it within. Other thing is we use pygments, but you can switch over to use Hugo's highlight which give much more better themes for the code block. |
6ba5054 to
63efd51
Compare
|
Could you please remove the |
75b28f1 to
9d34850
Compare
sayanchowdhury
left a comment
There was a problem hiding this comment.
Dropped a few comments - it should look exactly how it looks but there is some redundant code which needs to be removed.
|
Sure, on it! |
d1ed56f to
5daf7f0
Compare
|
Hello @yufi16, @sayanchowdhury! Sorry for the late response. Please use the existing SCSS variables. E.g. $flatcar-blue for #08a2af, $gray-100 for #f8f9fa, etc. These are exact matches already defined in _custom.scss and Bootstraps variables. Can you please check if "Fira Code" is properly loading? That is a custom font that is not installed on most of devices. |
Signed-off-by: yussaffi <yufi.alam@outlook.com>
| height: 2px; | ||
| position: absolute; | ||
| top: 0%; | ||
| top: 0; |
There was a problem hiding this comment.
Can you please use measurement units? It may still be correct without them, but it is a good practice to indicate them.
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| width: 100; |
| } | ||
|
|
||
| &.copied { | ||
| background: $flatcar-blue; /* cyan-blue feedback */ |
| border-radius: 6px; | ||
| display: block; | ||
| overflow-x: auto; | ||
| font-family: "Fira Code", monospace; |
There was a problem hiding this comment.
I just noticed we already load a monospace font family. Could we use $font-family-monospace instead (- that should include it)? Perhaps the difference doesn't make worth loading a new font family.
There was a problem hiding this comment.
what we have already is called overpass mono
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Overpass+Mono:wght@300;400;600;700&family=Overpass:ital,wght@0,100;0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet" media="print" onload="this.media='all'"/> | ||
|
|
||
| <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&display=swap" rel="stylesheet"> |
There was a problem hiding this comment.
If overpass mono is similar enough to fira code, I would suggest to drop fira code
|
Sure thing, On it! |



What this PR does / why we need it:
Introducing a Copy button feature to quickly copy code snippets, reducing friction and saving time.
Which issue(s) this PR fixes:
#2022 -> flatcar/Flatcar#2022
Does this PR introduce a user-facing change?
Enhancing code blocks with distinct background, improving readability and visual clarity.
Special Notes for your Reviewer: