Skip to content

Commit e2773bc

Browse files
authored
Fix layout, styles of admonition blocks with labels (#326)
1 parent 0618fe7 commit e2773bc

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/css/labels.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ div.labels {
1414
flex-wrap: wrap;
1515
}
1616

17-
.admonitionblock > div.labels {
18-
padding: 1rem 1rem 0.75rem;
17+
.admonitionblock div.labels {
18+
padding: 0.5rem 0 1rem;
1919
}
2020

2121
.header-label-container > div.labels {
@@ -62,16 +62,16 @@ h1 > .header-label {
6262
margin-bottom: 0.2rem;
6363
}
6464

65-
.has-label {
65+
.paragraph.has-label {
6666
padding-left: 0.4rem;
6767
border-left: 2px solid rgba(var(--colors-baltic-60));
6868
}
6969

70-
.has-label:has(> .labels > .label--new) {
70+
.paragraph.has-label:has(> .labels > .label--new) {
7171
border-left-color: var(--success-color);
7272
}
7373

74-
.has-label:has(> .labels > .label--deprecated) {
74+
.paragraph.has-label:has(> .labels > .label--deprecated) {
7575
border-left-color: var(--deprecated-color);
7676
}
7777

src/js/60-docs-roles.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ document.addEventListener('DOMContentLoaded', function () {
140140
// no need to do anything if we found only undefined roles
141141
if (labels.length === 0) return
142142

143-
const labelsLocation = (roleDiv.firstElementChild && headings.includes(roleDiv.firstElementChild.nodeName)) ? roleDiv.firstElementChild : roleDiv
143+
let labelsLocation = (roleDiv.firstElementChild && headings.includes(roleDiv.firstElementChild.nodeName)) ? roleDiv.firstElementChild : roleDiv
144144
const labelsDiv = createElement('div', 'labels')
145145

146146
for (const label of labels) {
@@ -154,6 +154,12 @@ document.addEventListener('DOMContentLoaded', function () {
154154
}
155155
}
156156

157+
console.log(roleDiv.classList)
158+
159+
if (roleDiv.classList.contains('admonitionblock')) {
160+
labelsLocation = roleDiv.querySelector('td.content')
161+
}
162+
157163
if (roleDiv.nodeName === 'H1' || headings.includes(roleDiv.firstElementChild.nodeName)) {
158164
labelsLocation.append(labelsDiv)
159165
labelsLocation.classList.add('header-label-container')

0 commit comments

Comments
 (0)