Skip to content

Commit 6b8f8ea

Browse files
authored
Add warning message for Beta versions (#664)
1 parent de7353a commit 6b8f8ea

File tree

5 files changed

+45
-15
lines changed

5 files changed

+45
-15
lines changed

packages/showcase/src/app/app.component.html

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,35 @@
107107
}
108108

109109
<main>
110-
<article>
111-
@if (selectedLink().id !== "/" && !versioning.isLatestVersion()) {
112-
<blockquote class="blockquote-warning version-no-longer-maintained">
113-
<p>
114-
This is documentation for Mercury
115-
<span class="body-semi-bold-m">{{ libraryVersion }}</span
116-
>, which is no longer actively maintained.
117-
</p>
110+
@if (selectedLink().id !== "/" && !versioning.isLatestVersion()) {
111+
<blockquote class="blockquote-warning version-no-longer-maintained">
112+
<div class="blockquote-warning__container">
113+
@if (versioning.isBetaVersion) {
114+
<p>
115+
This is the documentation for the upcoming
116+
<span class="body-semi-bold-m"
117+
>Mercury {{ libraryVersionWithoutBeta }}</span
118+
>
119+
version, which is currently in Beta.
120+
</p>
121+
} @else {
122+
<p>
123+
This is the documentation for Mercury
124+
<span class="body-semi-bold-m">{{ libraryVersion }}</span
125+
>, which is no longer actively maintained.
126+
</p>
127+
}
118128

119129
<p>
120130
For up-to-date documentation, see the
121131
<a class="body-semi-bold-m" href="/"
122132
>latest Mercury version ({{ versioning.latestVersion() }})</a
123133
>.
124134
</p>
125-
</blockquote>
126-
}
127-
135+
</div>
136+
</blockquote>
137+
}
138+
<article>
128139
<router-outlet style="display: contents" />
129140
</article>
130141
</main>

packages/showcase/src/app/app.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class AppComponent {
100100
];
101101

102102
libraryVersion = `v${mercuryVersion}`;
103+
libraryVersionWithoutBeta = `v${mercuryVersion.replace(/-beta.*/, "")}`;
103104

104105
constructor() {
105106
this.router.events.subscribe(event => {

packages/showcase/src/app/app.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ main {
110110
}
111111

112112
.version-no-longer-maintained {
113-
justify-self: center;
114113
margin-block-end: 48px;
114+
margin-block-start: -40px;
115+
text-align: center;
115116
}

packages/showcase/src/services/versioning.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const checkIfCurrentVersionIsTheLatest = (
1919
return latestReleasedVersion === mercuryVersion;
2020
};
2121

22+
const checkIfCurrentVersionIsBeta = (): boolean =>
23+
mercuryVersion.includes("beta") || mercuryVersion.includes("next");
24+
2225
@Injectable({ providedIn: "root" })
2326
export class VersioningService {
2427
platform = inject(PLATFORM_ID);
@@ -32,6 +35,8 @@ export class VersioningService {
3235
checkIfCurrentVersionIsTheLatest(this.latestVersion())
3336
);
3437

38+
isBetaVersion = checkIfCurrentVersionIsBeta();
39+
3540
constructor() {
3641
if (isPlatformBrowser(this.platform)) {
3742
// fetch("/services/versions")

packages/showcase/src/styles.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,26 @@ ch-code {
106106
}
107107

108108
.blockquote-warning {
109-
padding: 16px;
109+
display: grid;
110+
justify-content: center;
111+
padding: 6px;
110112
margin: 0;
111-
margin-block-start: 16px;
112113
border-inline-start: 2px solid var(--color-border-neutral-default);
113114
background-color: var(--mer-color__message-yellow--200);
114-
border-radius: 4px;
115115
color: var(--mer-text__on-message);
116116
line-height: 1.5;
117+
118+
&__container {
119+
display: grid;
120+
max-inline-size: var(--main-content-max-inline-size);
121+
margin-inline: var(--main-content-margin-inline);
122+
text-align: center;
123+
gap: 4px;
124+
125+
a:hover {
126+
text-decoration: underline;
127+
}
128+
}
117129
}
118130

119131
.hyperlink {

0 commit comments

Comments
 (0)