mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 05:09:41 +02:00
feat: add copy button to header
This commit is contained in:
parent
285b94779f
commit
dc0c32a93f
2 changed files with 21 additions and 0 deletions
|
@ -1,4 +1,11 @@
|
||||||
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }}">
|
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }}">
|
||||||
|
{%
|
||||||
|
include 'components/copy-button.twig' with {
|
||||||
|
ariaLabel: 'Copy Link to the ' ~ text,
|
||||||
|
class: 'block-header__copy-button',
|
||||||
|
textToCopy: '#' ~ text | urlify,
|
||||||
|
}
|
||||||
|
%}
|
||||||
<a href="#{{ text | urlify }}">
|
<a href="#{{ text | urlify }}">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -125,6 +125,20 @@
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__copy-button {
|
||||||
|
margin-right: 8px;
|
||||||
|
color: var(--color-text-second);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (--can-hover) {
|
||||||
|
&:hover {
|
||||||
|
.block-header__copy-button {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.inline-code {
|
.inline-code {
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue