Skip to content

Commit

Permalink
Ajoute une icône et un curseur spécifique
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen committed Mar 31, 2022
1 parent d37d9db commit 93fd92c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assets/js/spoiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@

function buildNewSpoilers() {
for (const spoiler of document.querySelectorAll('details.custom-block-spoiler')) {
if (spoiler.querySelector('summary') === null) {
const summary = document.createElement('summary')
let summary = spoiler.querySelector('summary')
if (summary === null) {
summary = document.createElement('summary')
summary.classList.add('custom-block-heading')
summary.textContent = 'Afficher/Masquer le contenu masqué'
const body = spoiler.querySelector('.custom-block-body')
spoiler.insertBefore(summary, body)
}
if (!summary.classList.contains('ico-after')) {
summary.classList.add('ico-after', 'view', 'light')
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions assets/scss/base/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ h6 {
}
}

.custom-block-spoiler summary.custom-block-heading {
cursor: pointer;

&.ico-after {
padding-left: 3.2rem;

&:after {
margin: 0.8rem 0 0 1rem;
}
}
}

.js .spoiler, div.custom-block-spoiler {
display: none;
}
Expand Down

0 comments on commit 93fd92c

Please sign in to comment.