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
20 changes: 20 additions & 0 deletions preview-src/banner-note.adoc
Original file line number Diff line number Diff line change
@@ -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
----
20 changes: 20 additions & 0 deletions preview-src/banner-warning.adoc
Original file line number Diff line number Diff line change
@@ -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
----
4 changes: 4 additions & 0 deletions preview-src/docs-roles.adoc
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
8 changes: 8 additions & 0 deletions preview-src/ui-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions src/css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/css/nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/css/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down
3 changes: 3 additions & 0 deletions src/css/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
{{> head defaultPageTitle='Untitled'}}
</head>
<body class="article{{#with (or page.attributes.role page.role)}} {{{this}}}{{/with}}{{#with asciidoc.attributes.role}} {{{this}}}{{/with}}{{#with (or page.attributes.theme "developer")}} {{{this}}}{{/with}}{{#with (or page.attributes.styles page.styles)}} {{{this}}}{{/with}}{{#if (or page.attributes.show-labels page.show-labels)}} show-labels{{/if}}">
<body class="article{{#if page.attributes.banner}} has-banner{{/if}}{{#with (or page.attributes.role page.role)}} {{{this}}}{{/with}}{{#with asciidoc.attributes.role}} {{{this}}}{{/with}}{{#with (or page.attributes.theme "developer")}} {{{this}}}{{/with}}{{#with (or page.attributes.styles page.styles)}} {{{this}}}{{/with}}{{#if (or page.attributes.show-labels page.show-labels)}} show-labels{{/if}}">
{{> header}}
{{> body}}
{{> footer}}
Expand Down
11 changes: 11 additions & 0 deletions src/partials/header-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,15 @@
{{/if}}
</div>
</nav>
{{#if (and page.attributes.banner page.attributes.banner-text)}}
<div class="header-banner{{#with (or page.attributes.banner "info")}} {{{this}}}-banner{{/with}}">
<span>{{#with page.attributes.banner-text}}{{{this}}}{{/with}}</span>
{{#if page.attributes.banner-link}}
<span>
<a href="{{{page.attributes.banner-link}}}">{{#with (or page.attributes.banner-link-text page.attributes.banner-link)}}{{{this}}}{{/with}}</a>
</span>
{{/if}}
</div>
{{/if}}

</header>