Skip to content

Commit 5c7f0c8

Browse files
committed
Add banner of unstable docs page
1 parent 9f91925 commit 5c7f0c8

File tree

3 files changed

+92
-19
lines changed

3 files changed

+92
-19
lines changed

.github/workflows/publish-docs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ jobs:
1515
contents: write
1616
steps:
1717

18+
- name: Get latest stable version tag
19+
id: get_version
20+
run: |
21+
latest_tag=$(git describe --tags --abbrev=0)
22+
echo "version=${latest_tag#v}" >> $GITHUB_OUTPUT
23+
1824
- name: ❄ Setup Nix/Cachix
1925
uses: ./.github/actions/nix-cachix-setup
2026
with:
@@ -24,6 +30,8 @@ jobs:
2430
uses: actions/checkout@v4
2531

2632
- name: Build documentation and compute benchmarks
33+
env:
34+
DOCS_VERSION: ${{ github.ref_name == 'master' && 'unstable' || steps.get_version.outputs.version }}
2735
run: |
2836
2937
# Release

docs/docusaurus.config.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ const lightCodeTheme = require("prism-react-renderer/themes/github");
55
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
66
const docsMetadataJson = require("./static/docs-metadata.json");
77

8+
const SITE_URL = "https://hydra.family";
9+
const BASE_URL = "/head-protocol/";
10+
11+
// The version is set by the DOCS_VERSION environment variable during the build.
12+
// It defaults to "unstable" for local development.
13+
const VERSION = process.env.DOCS_VERSION || "unstable";
14+
15+
const isUnstable = VERSION === "unstable";
16+
817
const customFields = {
918
apiSpecDir: "../hydra-node/json-schemas",
1019
apiSpecUrl: "api.yaml",
@@ -17,8 +26,8 @@ const editUrl = "https://github.com/cardano-scaling/hydra/tree/master/docs";
1726
/** @type {import('@docusaurus/types').Config} */
1827
const config = {
1928
title: "Hydra Head protocol documentation",
20-
url: "https://hydra.family",
21-
baseUrl: "/head-protocol/",
29+
url: SITE_URL,
30+
baseUrl: BASE_URL,
2231
// Note: This gives warnings about the haddocks; but actually they are
2332
// present. If you are concerned, please check the links manually!
2433
onBrokenLinks: "throw",
@@ -158,6 +167,13 @@ const config = {
158167
disableSwitch: false,
159168
respectPrefersColorScheme: false,
160169
},
170+
announcementBar: isUnstable
171+
? {
172+
id: "unstable_docs_banner",
173+
content: `This is the documentation for the unstable version of Hydra. For the latest stable version, see <a target="_blank" rel="noopener noreferrer" href="${SITE_URL}${BASE_URL}docs">here</a>.`,
174+
isCloseable: false,
175+
}
176+
: undefined,
161177
navbar: {
162178
title: "Hydra Head protocol",
163179
logo: {
@@ -167,6 +183,11 @@ const config = {
167183
srcDark: "img/hydra-white.png",
168184
},
169185
items: [
186+
{
187+
type: "html",
188+
position: "right",
189+
value: `<span class="navbar-version">${VERSION}</span>`,
190+
},
170191
{
171192
to: "/docs",
172193
label: "User manual",

docs/src/css/custom.css

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@
9090
html:not(.plugin-pages)[data-theme="dark"] {
9191
--ifm-color-primary: var(--ifm-color-primary-light);
9292
}
93+
9394
html.plugin-pages[data-theme='dark'] {
9495
--ifm-navbar-link-color: #1c1e21;
9596
}
96-
html.plugin-pages .navColorModeToggle{
97+
98+
html.plugin-pages .navColorModeToggle {
9799
display: none;
98100
}
99101

@@ -123,7 +125,8 @@ h4 {
123125
line-height: 30px !important;
124126
}
125127

126-
html:not([data-theme='dark']), html.plugin-pages {
128+
html:not([data-theme='dark']),
129+
html.plugin-pages {
127130
@apply text-black;
128131
}
129132

@@ -196,8 +199,10 @@ html:not([data-theme='dark']), html.plugin-pages {
196199

197200
/* Hide scrollbar for IE, Edge and Firefox */
198201
.no-scrollbar {
199-
-ms-overflow-style: none; /* IE and Edge */
200-
scrollbar-width: none; /* Firefox */
202+
-ms-overflow-style: none;
203+
/* IE and Edge */
204+
scrollbar-width: none;
205+
/* Firefox */
201206
}
202207

203208
.homepageText {
@@ -228,6 +233,7 @@ html:not([data-theme='dark']), html.plugin-pages {
228233
width: 1em;
229234
height: 4em;
230235
}
236+
231237
.loader {
232238
color: var(--ifm-color-primary);
233239
text-indent: -9999em;
@@ -240,39 +246,48 @@ html:not([data-theme='dark']), html.plugin-pages {
240246
-webkit-animation-delay: -0.16s;
241247
animation-delay: -0.16s;
242248
}
249+
243250
.loader:before,
244251
.loader:after {
245252
position: absolute;
246253
top: 0;
247254
content: "";
248255
}
256+
249257
.loader:before {
250258
left: -1.5em;
251259
-webkit-animation-delay: -0.32s;
252260
animation-delay: -0.32s;
253261
}
262+
254263
.loader:after {
255264
left: 1.5em;
256265
}
266+
257267
@-webkit-keyframes load1 {
268+
258269
0%,
259270
80%,
260271
100% {
261272
box-shadow: 0 0;
262273
height: 4em;
263274
}
275+
264276
40% {
265277
box-shadow: 0 -2em;
266278
height: 5em;
267279
}
268280
}
281+
269282
@keyframes load1 {
283+
270284
0%,
271285
80%,
272286
100% {
273287
box-shadow: 0 0;
274288
height: 4em;
275289
}
290+
276291
40% {
277292
box-shadow: 0 -2em;
278293
height: 5em;
@@ -328,11 +343,13 @@ html.plugin-pages .navbar__brand:hover {
328343
.DocSearch-Button {
329344
margin: 0 10px 0 16px !important;
330345
}
346+
331347
.DocSearch-Button .DocSearch-Search-Icon {
332348
color: black !important;
333349
height: 24px !important;
334350
width: 24px;
335351
}
352+
336353
html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-Icon {
337354
color: white !important;
338355
}
@@ -373,7 +390,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
373390
margin-left: 32px;
374391
}
375392

376-
.mobile-side-menu > .menu__list-item > .menu__link {
393+
.mobile-side-menu>.menu__list-item>.menu__link {
377394
color: #283032 !important;
378395
}
379396

@@ -395,7 +412,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
395412
font-weight: 700;
396413
}
397414

398-
.breadcrumbs__item--active > span {
415+
.breadcrumbs__item--active>span {
399416
background-color: #e7eef0 !important;
400417
}
401418

@@ -407,6 +424,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
407424
.markdown {
408425
padding: 32px 0 16px 0px !important;
409426
}
427+
410428
.container {
411429
padding: 24px 32px 56px 32px !important;
412430
}
@@ -417,6 +435,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
417435
padding: 56px !important;
418436
padding-right: 0 !important;
419437
}
438+
420439
.container {
421440
padding: 24px 16px 24px 16px !important;
422441
}
@@ -456,15 +475,15 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
456475
@apply !bg-transparent;
457476
}
458477

459-
.theme-doc-toc-mobile > button {
478+
.theme-doc-toc-mobile>button {
460479
@apply font-semibold text-black rounded p-4 mt-12 bg-primary-extralight;
461480
}
462481

463-
.theme-doc-toc-mobile > div > ul {
482+
.theme-doc-toc-mobile>div>ul {
464483
@apply border-none;
465484
}
466485

467-
.theme-doc-toc-mobile > button::after {
486+
.theme-doc-toc-mobile>button::after {
468487
@apply bg-cover;
469488
}
470489

@@ -478,27 +497,27 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
478497
line-height: 1.65;
479498
}
480499

481-
.markdown > h1 {
500+
.markdown>h1 {
482501
font-size: 2rem;
483502
}
484503

485-
.markdown > h2 {
504+
.markdown>h2 {
486505
font-size: 1.8rem;
487506
}
488507

489-
.markdown > h3 {
508+
.markdown>h3 {
490509
font-size: 1.5rem;
491510
}
492511

493-
.markdown > h4 {
512+
.markdown>h4 {
494513
font-size: 1rem;
495514
}
496515

497-
.markdown > h5 {
516+
.markdown>h5 {
498517
font-size: 0.875rem;
499518
}
500519

501-
.markdown > h6 {
520+
.markdown>h6 {
502521
font-size: 0.75rem;
503522
}
504523

@@ -522,7 +541,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
522541
padding-left: var(--ifm-list-left-padding);
523542
}
524543

525-
.markdown > ul {
544+
.markdown>ul {
526545
margin-bottom: var(--ifm-leading);
527546
}
528547

@@ -547,7 +566,7 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
547566
list-style: circle;
548567
}
549568

550-
.markdown li + li {
569+
.markdown li+li {
551570
margin-top: var(--ifm-list-item-margin);
552571
}
553572

@@ -572,6 +591,31 @@ html:not(.plugin-pages)[data-theme='dark'] .DocSearch-Button .DocSearch-Search-I
572591
.theme-admonition p {
573592
margin-bottom: 0.5em;
574593
}
594+
575595
.theme-admonition p:last-child {
576596
margin-bottom: 0;
577597
}
598+
599+
.navbar-version {
600+
background-color: var(--ifm-color-primary-dark);
601+
color: white;
602+
padding: 0.2rem 0.5rem;
603+
border-radius: 0.5rem;
604+
font-size: 0.8rem;
605+
margin-right: 1rem;
606+
}
607+
608+
div.announcementBar {
609+
background-color: var(--ifm-background-surface-color);
610+
color: var(--ifm-font-color-base);
611+
font-weight: bold;
612+
}
613+
614+
div.announcementBar a {
615+
text-decoration: underline;
616+
}
617+
618+
html[data-theme='dark'] .table-of-contents__link:hover,
619+
html[data-theme='dark'] .table-of-contents__link--active {
620+
color: var(--ifm-color-primary-light);
621+
}

0 commit comments

Comments
 (0)