From 11e74689e63a3a4f0e2ba8002883d68d71b23435 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Fri, 8 Mar 2024 18:32:21 +0000 Subject: [PATCH] Roles labels refinement (#220) Fixes a few issues in the initial implementation of #211: - adds `cluster` and `dynamic` labels - fixes padding in admonitions --- preview-src/docs-roles.adoc | 8 +++++++- src/css/labels.css | 5 +++++ src/js/60-docs-roles.js | 5 +++-- src/js/data/rolesData.json | 9 +++++++++ src/partials/header-content.hbs | 12 ++++++++---- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/preview-src/docs-roles.adoc b/preview-src/docs-roles.adoc index 1fb6d250..3dd9d883 100644 --- a/preview-src/docs-roles.adoc +++ b/preview-src/docs-roles.adoc @@ -18,6 +18,12 @@ Flags sections as Not Available on Aura, Aura DB Enterprise, Enterprise Edition, Blocks with the appropriate roles have labels added. +[discrete] +[role="label--new-5.17 label--enterprise-edition"] +=== (Discrete) H3 AuraDB Enterprise AND Not on Aura + +Lorem ipsum dolor sit + [role=label--aura-db-enterprise label--not-on-aura] === H3 AuraDB Enterprise AND Not on Aura @@ -26,7 +32,7 @@ Lorem ipsum dolor sit Open blocks can be used to mark multiple paragraphs within a section. -[role=label--new-5.17] +[role=label--dynamic-5.17] -- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna. diff --git a/src/css/labels.css b/src/css/labels.css index 014aa938..87d2ad6f 100644 --- a/src/css/labels.css +++ b/src/css/labels.css @@ -10,6 +10,10 @@ flex-wrap: wrap; } +.admonitionblock > div.labels { + padding: 1rem 1rem 0.75rem; +} + .header-label-container > div.labels { display: flex; align-self: center; @@ -25,6 +29,7 @@ .header-label-container > div.labels.wrapped { margin-left: 0; + margin-top: 0.5rem; } .doc > .sect-header > h1.page:first-child:has(> .labels) { diff --git a/src/js/60-docs-roles.js b/src/js/60-docs-roles.js index 8189e7c7..4b6c867f 100644 --- a/src/js/60-docs-roles.js +++ b/src/js/60-docs-roles.js @@ -44,9 +44,10 @@ document.addEventListener('DOMContentLoaded', function () { } // get version number for version labels - if (rolesData[label].labelCategory === 'version' && labelParts[1]) { + if ((rolesData[label].labelCategory === 'version' || rolesData[label].versionText) && labelParts[1]) { labelDetails.data.version = labelParts[1] - labelDetails.text += ' in ' + labelDetails.data.version + const joinText = rolesData[label].versionText ? rolesData[label].versionText : 'in' + labelDetails.text = [labelDetails.text, joinText, labelDetails.data.version].join(' ') } return labelDetails diff --git a/src/js/data/rolesData.json b/src/js/data/rolesData.json index 176257f3..f71f2486 100644 --- a/src/js/data/rolesData.json +++ b/src/js/data/rolesData.json @@ -86,6 +86,11 @@ "labelCategory": "version", "displayText": "Discontinued" }, + "dynamic":{ + "labelCategory": "function", + "displayText": "Dynamic", + "versionText": "since" + }, "alpha":{ "labelCategory": "version", "displayText": "Alpha" @@ -184,6 +189,10 @@ "labelCategory": "environment", "displayText": "Windows" }, + "cluster":{ + "labelCategory": "function", + "displayText": "Cluster" + }, "cluster-member-core":{ "labelCategory": "function", "displayText": "CORE" diff --git a/src/partials/header-content.hbs b/src/partials/header-content.hbs index 0f66e624..e5571a0d 100644 --- a/src/partials/header-content.hbs +++ b/src/partials/header-content.hbs @@ -22,22 +22,26 @@ Labs {{else if (eq page.attributes.theme "kb")}} - + + {{!-- --}} Knowledge Base {{else if (eq page.attributes.theme "training")}} - + + {{!-- --}} GraphAcademy {{else if (eq page.attributes.theme "graphgists")}} - + + {{!-- --}} GraphGists {{else}} - + + {{!-- --}} Developer