Skip to content

Commit fbb8ca4

Browse files
authored
[OpenAPI] Added badge styling (#2920)
* Added spec * Added styling for edition badges * Removed spec * Removed console logs
1 parent b57fd6b commit fbb8ca4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/api_refs/redocly.hbs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@
2222
<script>
2323
window.addEventListener('load', () => {
2424
window.setTimeout(() => {
25+
// Remove badges from TOC
26+
document.querySelectorAll('.menu-content [role="menuitem"] [type="badge"]').forEach(el => el.remove());
27+
28+
// Apply badge styling
29+
document.querySelectorAll('.api-content [data-section-id] h2 [type="primary"]').forEach(el => {
30+
const color = el.getAttribute('color');
31+
el.style.backgroundColor = "#FFF";
32+
el.style.border = "1px solid " + color;
33+
el.style.padding = "1px 8px";
34+
el.style.marginRight = "8px";
35+
el.style.color = color;
36+
el.style.fontWeight = "initial";
37+
el.style.borderRadius = "0px";
38+
});
39+
40+
// Style logo
2541
let logo = document.querySelector('img[src$="ibexa-dxp-logo.png"]');
2642
logo.onclick = () => {
2743
let pathParts = document.location.pathname.split('/').slice(0, 3);

0 commit comments

Comments
 (0)