diff --git a/preview-src/banner-note.adoc b/preview-src/banner-note.adoc new file mode 100644 index 00000000..3c4f9375 --- /dev/null +++ b/preview-src/banner-note.adoc @@ -0,0 +1,20 @@ += Note banner +:page-theme: docs +:page-banner: note +:page-banner-text: Lorem ipsum dolor sit est. +:page-banner-link: https://neo4j.com/docs +:page-banner-link-text: Link text + + +[abstract] +-- +Add page banner attributes to a page to display a message between the header and the toolbar. +-- + +[source] +---- +:page-banner: note +:page-banner-text: Lorem ipsum dolor sit est. +:page-banner-link: https://neo4j.com/docs +:page-banner-link-text: Link text +---- \ No newline at end of file diff --git a/preview-src/banner-warning.adoc b/preview-src/banner-warning.adoc new file mode 100644 index 00000000..dafd780e --- /dev/null +++ b/preview-src/banner-warning.adoc @@ -0,0 +1,20 @@ += Warning banner +:page-theme: docs +:page-banner: warning +:page-banner-text: Lorem ipsum dolor sit est. +:page-banner-link: https://neo4j.com/docs +:page-banner-link-text: Link text + + +[abstract] +-- +Add page banner attributes to a page to display a message between the header and the toolbar +-- + +[source] +---- +:page-banner: warning +:page-banner-text: Lorem ipsum dolor sit est. +:page-banner-link: https://neo4j.com/docs +:page-banner-link-text: Link text +---- \ No newline at end of file diff --git a/preview-src/docs-roles.adoc b/preview-src/docs-roles.adoc index 6cc4b4e0..182fda69 100644 --- a/preview-src/docs-roles.adoc +++ b/preview-src/docs-roles.adoc @@ -1,6 +1,10 @@ = Docs `code test` flags :page-role: not-on-aura :page-theme: docs +:page-banner: warning +:page-banner-text: Lorem ipsum dolor sit est. +:page-banner-link: https://neo4j.com/docs +:page-banner-link-text: Link text // :page-labels: fabric enterprise-edition alpha test [abstract] diff --git a/preview-src/ui-model.yml b/preview-src/ui-model.yml index aa973eb2..22083df3 100644 --- a/preview-src/ui-model.yml +++ b/preview-src/ui-model.yml @@ -139,6 +139,14 @@ page: - content: Admonitions url: admonitions.html urlType: internal + - content: Page Banners + items: + - content: note + url: banner-note.html + urlType: internal + - content: warning + url: banner-warning.html + urlType: internal - content: Labels url: labels.html urlType: internal diff --git a/src/css/header.css b/src/css/header.css index c9473106..b4625b9e 100644 --- a/src/css/header.css +++ b/src/css/header.css @@ -6,6 +6,31 @@ body { padding-top: var(--navbar-height); } +.header-banner { + background: var(--note-background-color); + color: var(--note-color); + box-shadow: 0 0 1px var(--note-border-color); + font-size: calc(16 / var(--rem-base) * 1rem); + height: var(--banner-height); + position: fixed; + top: var(--navbar-height); + width: 100%; + display: flex; + align-items: center; + justify-content: center; + z-index: var(--z-index-banner); +} + +.header-banner.warning-banner { + background: var(--warning-background-color); + color: var(--warning-color); + box-shadow: 0 0 1px var(--warning-border-color); +} + +.header-banner span { + padding: 0.25rem; +} + .navbar { background: var(--navbar-background); color: var(--navbar-font-color); diff --git a/src/css/nav.css b/src/css/nav.css index 5185320f..e85669cc 100644 --- a/src/css/nav.css +++ b/src/css/nav.css @@ -50,6 +50,10 @@ position: sticky; height: var(--nav-height--desktop); } + + body.has-banner .nav { + top: calc(var(--navbar-height) + var(--banner-height)); + } } .nav .panels { diff --git a/src/css/toolbar.css b/src/css/toolbar.css index 4481ab57..2712b1e1 100644 --- a/src/css/toolbar.css +++ b/src/css/toolbar.css @@ -12,6 +12,10 @@ z-index: var(--z-index-toolbar); } +body.has-banner .toolbar { + top: calc(var(--navbar-height) + var(--banner-height)); +} + .toolbar-wrapper { display: flex; width: 100%; diff --git a/src/css/vars.css b/src/css/vars.css index 6d2cdcdc..10b75956 100644 --- a/src/css/vars.css +++ b/src/css/vars.css @@ -250,6 +250,7 @@ --tip-color: rgba(var(--theme-light-palette-primary-bg-strong)); --tip-background-color: rgba(var(--theme-light-palette-primary-bg-weak)); --warning-color: rgba(var(--theme-light-palette-danger-bg-strong)); + --warning-border-color: rgba(var(--theme-light-palette-danger-bg-strong)); --warning-background-color: rgba(var(--theme-light-palette-danger-bg-weak)); --mark-background: rgba(var(--theme-light-palette-primary-bg-weak)); @@ -370,6 +371,7 @@ /* dimensions and positioning */ --navbar-height: calc(68 / var(--rem-base) * 1rem); --toolbar-height: calc(45 / var(--rem-base) * 1rem); + --banner-height: calc(45 / var(--rem-base) * 1rem); --drawer-height: var(--toolbar-height); --body-top: var(--navbar-height); --body-min-height: calc(100vh - var(--body-top)); @@ -398,6 +400,7 @@ /* stacking */ --z-index-nav: 1; --z-index-toolbar: 20; + --z-index-banner: 30; --z-index-code: 10; --z-index-page-version-menu: 3; --z-index-navbar: 5000; diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs index 5f06a87b..9c590b17 100644 --- a/src/layouts/default.hbs +++ b/src/layouts/default.hbs @@ -3,7 +3,7 @@ {{> head defaultPageTitle='Untitled'}} - + {{> header}} {{> body}} {{> footer}} diff --git a/src/partials/header-content.hbs b/src/partials/header-content.hbs index 10f0e55e..1787ace3 100644 --- a/src/partials/header-content.hbs +++ b/src/partials/header-content.hbs @@ -103,4 +103,15 @@ {{/if}} + {{#if (and page.attributes.banner page.attributes.banner-text)}} +
+ {{#with page.attributes.banner-text}}{{{this}}}{{/with}} + {{#if page.attributes.banner-link}} + + {{#with (or page.attributes.banner-link-text page.attributes.banner-link)}}{{{this}}}{{/with}} + + {{/if}} +
+ {{/if}} +