Skip to content

Commit dc0c32a

Browse files
committed
feat: add copy button to header
1 parent 285b947 commit dc0c32a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/backend/views/pages/blocks/header.twig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }}">
2+
{%
3+
include 'components/copy-button.twig' with {
4+
ariaLabel: 'Copy Link to the ' ~ text,
5+
class: 'block-header__copy-button',
6+
textToCopy: '#' ~ text | urlify,
7+
}
8+
%}
29
<a href="#{{ text | urlify }}">
310
{{ text }}
411
</a>

src/frontend/styles/components/page.pcss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@
125125
pointer-events: none;
126126
}
127127

128+
&__copy-button {
129+
margin-right: 8px;
130+
color: var(--color-text-second);
131+
opacity: 0;
132+
}
133+
134+
@media (--can-hover) {
135+
&:hover {
136+
.block-header__copy-button {
137+
opacity: 1;
138+
}
139+
}
140+
}
141+
128142
.inline-code {
129143
line-height: inherit;
130144
}

0 commit comments

Comments
 (0)