Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 94 additions & 11 deletions preview-src/ui-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,102 @@ site:
homeUrl: &home_url http://localhost:5252
components:
- &component
name: datastax
title: PREVIEW Datastax Docs
url: '#'
name: xyz
title: &component_title Preview Docs
url: /xyz/6.0/index.html
versions:
- &latest_version
url: *home_url
version: 'latest'
displayVersion: 'latest'
latestVersion: *latest_version
- &latest_version_xyz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most changes to this file are to show the version switcher, copied from the default Antora UI

url: /xyz/6.0/index.html
version: '6.0'
displayVersion: '6.0'
- &component_version
title: *component_title
url: '#'
version: '5.2'
displayVersion: '5.2'
- url: '#'
version: '5.1'
displayVersion: '5.1'
- url: '#'
version: '5.0'
displayVersion: '5.0'
latestVersion: *latest_version_xyz
keys:
globalNav: |
[
{
"title": "Docs Home",
"url": "#",
"home": true
},
{
"title": "Astra DB",
"items": [
{ "title": "Serverless", "url": "#" },
{ "title": "Dedicated", "url": "#" },
{ "title": "CLI", "url": "#" }
]
},
{
"title": "RAGStack",
"url": "#"
},
{
"title": "DSE",
"items": [
{ "title": "Mission Control", "url": "#" },
{ "title": "DSE 6.8", "url": "#" },
{ "title": "DSE 5.1", "url": "#" },
{ "title": "CLI", "url": "#" }
]
},
{
"title": "Streaming",
"items": [
{ "title": "Astra Streaming", "url": "#" },
{ "title": "Luna Streaming", "url": "#" }
]
},
{
"title": "Open Source",
"items": [
{ "title": "Apache Pulsar Connector", "url": "#" },
{ "title": "CDC for Cassandra", "url": "#" },
{ "title": "K8ssandra", "url": "#" },
{ "title": "Stargate", "url": "#" },
{ "title": "Starlight for JMS", "url": "#" },
{ "title": "Starlight for Kafka", "url": "#" },
{ "title": "Starlight for Rabbit MQ", "url": "#" }
]
}
]
page:
src:
component: *component
version: *latest_version
url: *home_url
home: true
title: Brand’s Hardware & Software Requirements
component: *component
componentVersion: *component_version
version: '5.2'
displayVersion: '5.2'
module: ROOT
relativeSrcPath: index.adoc
editUrl: http://example.com/project-xyz/blob/main/index.adoc
origin:
private: false
versions:
- version: '6.0'
displayVersion: '6.0'
url: '#'
- version: '5.2'
displayVersion: '5.2'
url: '#'
- version: '5.1'
displayVersion: '5.1'
url: '#'
- version: '5.0'
displayVersion: '5.0'
missing: true
url: '#'
navigation:
- content: Page Templates
items:
Expand Down
8 changes: 4 additions & 4 deletions src/css/asciidoc/doc.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.doc h4 {
@apply text-h4;
color: var(--ds-text-tertiary);
margin: calc(32/var(--rem-base)*1rem) 0 0;
margin: calc(32 / var(--rem-base) * 1rem) 0 0;
}

.doc h5 {
Expand All @@ -63,12 +63,12 @@

.doc h2:not(.discrete) {
border-bottom: 1px solid var(--ds-divider);
margin: calc(80/var(--rem-base)*1rem) 0 0;
margin: calc(80 / var(--rem-base) * 1rem) 0 0;
padding: 0 0 calc(16 / var(--rem-base) * 1rem);
}

.doc h3:not(.discrete) {
margin: calc(64/var(--rem-base)*1rem) 0 0;
margin: calc(64 / var(--rem-base) * 1rem) 0 0;
}

.doc h4:not(.discrete) {
Expand All @@ -85,7 +85,7 @@
justify-content: flex-end;
align-items: center;
gap: var(--ds-space-h);
scroll-margin-top: 6rem;
scroll-margin-top: 9rem;
}

.doc h1 .anchor,
Expand Down
7 changes: 6 additions & 1 deletion src/css/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
color: var(--ds-text-tertiary);
}

.text-link {
.text-inverse {
color: var(--ds-text-inverse);
}

.text-link,
.color-primary {
color: var(--ds-primary-main);
}

Expand Down
8 changes: 8 additions & 0 deletions src/css/components/btn.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
@apply bg-[var(--ds-primary-solid-bg)] text-[var(--ds-primary-solid-color)] hover:bg-[var(--ds-primary-solid-hover-bg)] hover:text-[var(--ds-primary-solid-color)] active:bg-[var(--ds-primary-solid-active-bg)] disabled:bg-[var(--ds-primary-solid-disabled-bg)] disabled:text-[var(--ds-primary-solid-disabled-color)];
}

.btn-primary.btn-soft {
@apply bg-[var(--ds-primary-soft-bg)] text-[var(--ds-primary-soft-color)] hover:bg-[var(--ds-primary-soft-hover-bg)] hover:text-[var(--ds-primary-soft-color)] active:bg-[var(--ds-primary-soft-active-bg)] disabled:bg-[var(--ds-primary-soft-disabled-bg)] disabled:text-[var(--ds-primary-soft-disabled-color)];
}

.btn-neutral.btn-outlined {
@apply border-[var(--ds-neutral-outlined-border)] text-[var(--ds-neutral-outlined-color)] hover:border-[var(--ds-neutral-outlined-hover-border)] hover:bg-[var(--ds-neutral-outlined-hover-bg)] hover:text-[var(--ds-neutral-outlined-color)] active:border-[var(--ds-neutral-outlined-active-border)] active:bg-[var(--ds-neutral-outlined-active-bg)] disabled:border-[var(--ds-neutral-outlined-disabled-border)] disabled:text-[var(--ds-neutral-outlined-disabled-color)];
}
Expand All @@ -31,6 +35,10 @@
@apply h-10 w-10 p-0;
}

.btn-small {
@apply h-8 px-2 py-1;
}

.btn-leading-icon {
@apply mr-2 flex;
}
Expand Down
15 changes: 15 additions & 0 deletions src/css/components/dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@layer components {
.dropdown .dropdown-content {
@apply invisible fixed left-0 top-0 origin-top scale-95 transform opacity-0 motion-safe:transition motion-safe:duration-300 motion-safe:ease-in-out;

/* Shadow-100 */
box-shadow:
0px 4px 5px 0px rgba(10, 10, 10, 0.08),
0px 1px 10px 0px rgba(10, 10, 10, 0.08),
0px 2px 4px 0px rgba(32, 41, 58, 0.14);
}

.dropdown .dropdown-content.active {
@apply visible scale-100 opacity-100;
}
}
32 changes: 32 additions & 0 deletions src/css/global-nav.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.global-nav > .scroll-btn-left,
.global-nav > .scroll-btn-right {
@apply invisible absolute opacity-0 motion-safe:transition-all;

&.active {
@apply visible opacity-100;
}
}

.global-nav > .scroll-btn-left {
@apply left-0 rounded-tl py-3 pl-2 pr-4;
}

.global-nav > .scroll-btn-right {
@apply right-0 rounded-tr py-3 pl-4 pr-2;
}

html[data-theme="light"] .global-nav > .scroll-btn-left {
background: linear-gradient(to left, rgba(255, 255, 255, 0), rgb(255, 255, 255), rgb(255, 255, 255) 50%);
}

html[data-theme="dark"] .global-nav > .scroll-btn-left {
background: linear-gradient(to left, rgba(9, 9, 9, 0), rgb(9, 9, 9), rgb(9, 9, 9) 50%);
}

html[data-theme="light"] .global-nav > .scroll-btn-right {
background: linear-gradient(to right, rgba(255, 255, 255, 0), rgb(255, 255, 255), rgb(255, 255, 255) 50%);
}

html[data-theme="dark"] .global-nav > .scroll-btn-right {
background: linear-gradient(to right, rgba(9, 9, 9, 0), rgb(9, 9, 9), rgb(9, 9, 9) 50%);
}
2 changes: 2 additions & 0 deletions src/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import "components/input.css";
@import "components/drawer.css";
@import "components/collapse.css";
@import "components/dropdown.css";
@import "typeface/typeface-material-icons-outlined.css";
@import "typeface/typeface-roboto-flex.css";
@import "typeface/typeface-sora.css";
Expand All @@ -23,6 +24,7 @@
@import "highlight.css";
@import "print.css";
@import "docsearch.css";
@import "global-nav.css";

@tailwind base;
@tailwind components;
Expand Down
8 changes: 4 additions & 4 deletions src/css/vars/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
--ds-focus-visible: var(--ds-neutral-900);
--ds-background-body: var(--ds-common-white);
--ds-background-level1: var(--ds-neutral-0);
--ds-background-level2: var(--ds-neutral-50);
--ds-background-level3: var(--ds-neutral-100);
--ds-background-level2: var(--ds-neutral-100);
--ds-background-level3: var(--ds-neutral-300);
--ds-background-surface: var(--ds-common-white);
--ds-background-tooltip: var(--ds-neutral-900);
--ds-background-backdrop: rgba(0, 0, 0, 0.6);
Expand Down Expand Up @@ -42,10 +42,10 @@
--ds-neutral-outlined-disabled-color: var(--ds-neutral-300);
--ds-neutral-outlined-hover-bg: var(--ds-neutral-0);
--ds-neutral-outlined-hover-border: var(--ds-neutral-900);
--ds-neutral-plain-active-bg: var(--ds-neutral-200);
--ds-neutral-plain-active-bg: var(--ds-neutral-100);
--ds-neutral-plain-color: var(--ds-neutral-900);
--ds-neutral-plain-disabled-color: var(--ds-neutral-200);
--ds-neutral-plain-hover-bg: var(--ds-neutral-100);
--ds-neutral-plain-hover-bg: var(--ds-neutral-0);
--ds-neutral-soft-active-bg: var(--ds-neutral-300);
--ds-neutral-soft-bg: var(--ds-neutral-0);
--ds-neutral-soft-color: var(--ds-neutral-900);
Expand Down
1 change: 0 additions & 1 deletion src/css/vars/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
--ds-neutral-200: #ced0d2;
--ds-neutral-300: #a6aaae;
--ds-neutral-400: #898d91;
--ds-neutral-50: #edeeee;
--ds-neutral-500: #6b6f73;
--ds-neutral-600: #5a5d60;
--ds-neutral-700: #494a4d;
Expand Down
28 changes: 28 additions & 0 deletions src/helpers/global-nav-active.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict'

module.exports = module.exports = (navItem, {
data: {
root: { page },
},
}) => {
const pageVersion = page.componentVersion?.version
const pageComponent = page.component?.name

const matchesComponentAndVersion = (item) => {
if (pageVersion) {
return item.component === pageComponent && item.version === pageVersion
} else {
return item.component === pageComponent
}
}

if (navItem.component) {
return matchesComponentAndVersion(navItem)
}

if (navItem.items) {
return navItem.items.some(matchesComponentAndVersion)
}

return false
}
44 changes: 44 additions & 0 deletions src/helpers/global-nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use strict'

const mapNavList = (list, contentCatalog) => {
return list.map((item) => {
if (item.xref) {
const page = contentCatalog.resolvePage(item.xref)
if (page) item.url = page.pub.url
if (page?.src?.component) {
item.component = page.src.component
}
if (page?.src?.version) {
item.version = page.src.version
}
item.urlType = 'internal'
delete item.xref
}
if (item.url && item.url.startsWith('http')) item.urlType = 'external'
if (item.items) {
item.items = mapNavList(item.items, contentCatalog)
}
return item
})
}

module.exports = ({
data: {
root: {
contentCatalog = { resolvePage: () => undefined, getComponent: () => undefined },
site,
},
},
}) => {
let globalNav = site?.keys?.globalNav

if (!globalNav) return []
if (globalNav._compiled) return globalNav

globalNav = mapNavList(JSON.parse(globalNav), contentCatalog)

globalNav._compiled = true

site.keys.globalNav = globalNav
return globalNav
}
File renamed without changes.
File renamed without changes.
Loading