Skip to content

Commit

Permalink
Add beta-until label (#254)
Browse files Browse the repository at this point in the history
For new and deprectaed labels it is already possible to include a
version number. Although we have a generic `beta` label that can be used
to display just the text `Beta`, there is no way to display a version
with the text, for example `Beta until 5.12`.

This PR adds a new `label--beta-until-<version>` role to be used for
beta labels where a version number is also required.
  • Loading branch information
recrwplay authored Aug 22, 2024
1 parent 34b1d0e commit f4dec1d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions preview-src/docs-roles.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Flags sections as Not Available on Aura, Aura DB Enterprise, Enterprise Edition,
--


[role=label--new-5.11 label--beta-until-5.12]
== Beta until

Lorem ipsum.


[role="label--new-5.17 label--enterprise-edition"]
== Relationship property type constraints

Expand Down
3 changes: 2 additions & 1 deletion src/css/labels.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ span.label--yes {
}

span.label--alpha,
span.label--beta {
span.label--beta,
span.label--beta-until {
background: var(--alpha-beta-background-color);
color: var(--alpha-beta-color);
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/60-docs-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ document.addEventListener('DOMContentLoaded', function () {

// label could be eg aura-db-enterprise - we use the full label
// label could be eg new-5.20 - we use 'new' for the label and add the version as text
label = (rolesData[label] && rolesData[label].category !== 'version') ? label : labelParts[0]
label = (rolesData[label] && rolesData[label].labelCategory !== 'version') ? label : labelParts.slice(0, -1).join('-')

// ignore labels that are not defined in rolesData
if (!rolesData[label]) {
Expand All @@ -47,7 +47,7 @@ document.addEventListener('DOMContentLoaded', function () {

// get version number for version labels
if ((rolesData[label].labelCategory === 'version' || rolesData[label].versionText) && labelParts[1]) {
labelDetails.data.version = labelParts[1]
labelDetails.data.version = labelParts.pop()
const joinText = rolesData[label].versionText ? rolesData[label].versionText : 'in'
labelDetails.text = [labelDetails.text, joinText, labelDetails.data.version].join(' ')
}
Expand Down
6 changes: 6 additions & 0 deletions src/js/data/rolesData.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
"labelCategory": "version",
"displayText": "Beta"
},
"beta-until":{
"description": "The feature or function was in beta until the version specified",
"labelCategory": "version",
"displayText": "Beta",
"versionText": "until"
},
"deprecated":{
"labelCategory": "version",
"displayText": "Deprecated"
Expand Down

0 comments on commit f4dec1d

Please sign in to comment.