1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 01:36:55 +01:00

Merge pull request #258 from bigchaindb/feature/code-title

output language above all code blocks
This commit is contained in:
Matthias Kretschmann 2018-08-29 12:38:55 +02:00 committed by GitHub
commit 7b92d044d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

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

View File

@ -77,17 +77,26 @@ pre {
.btn--clipboard, .btn--clipboard,
.success__text { .success__text {
position: absolute; position: absolute;
top: .1rem; top: $spacer * 1.65;
right: .1rem; right: .1rem;
} }
.success__text { .success__text {
top: 2rem; top: $spacer * 3.5;
right: -1.5rem; right: -1.5rem;
font-size: $font-size-xs; 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 { .btn--clipboard {
padding: 0 $spacer / 2; padding: 0 $spacer / 2;
box-shadow: none; box-shadow: none;