1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-25 03:03:16 +01:00

output language above all code blocks

This commit is contained in:
Matthias Kretschmann 2018-08-28 18:34:30 +02:00
parent 7369f0747d
commit 5cb7c8b840
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,10 @@ document.addEventListener('DOMContentLoaded', (event) => {
const codeBlocks = document.querySelectorAll('.highlight')
codeBlocks.forEach(codeBlock => {
const language = codeBlock.getElementsByTagName('code')[0].dataset.lang
codeBlock.insertAdjacentHTML('afterbegin', clipboardButton)
codeBlock.insertAdjacentHTML('afterbegin', `<h6 class="highlight__title">${language}</h6>`)
})
const buttons = document.querySelectorAll('.highlight .btn--clipboard')

View File

@ -77,17 +77,26 @@ pre {
.btn--clipboard,
.success__text {
position: absolute;
top: .1rem;
top: $spacer * 1.65;
right: .1rem;
}
.success__text {
top: 2rem;
top: $spacer * 3.5;
right: -1.5rem;
font-size: $font-size-xs;
}
}
.highlight__title {
margin-top: 0;
margin-bottom: $spacer / 4;
margin-left: $spacer / 1.5;
font-size: $font-size-sm;
color: $gray-light;
display: inline-block;
}
.btn--clipboard {
padding: 0 $spacer / 2;
box-shadow: none;