Skip to content

Commit 9403338

Browse files
committed
Add top banner
1 parent 9044234 commit 9403338

File tree

6 files changed

+115
-24
lines changed

6 files changed

+115
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@
8383
"build:libraries": "node libraries.js"
8484
},
8585
"heroku-run-build-script": true
86-
}
86+
}

src/website/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
shareJwtTextElement,
1212
} from "./dom-elements.js";
1313
import { CCPAModal } from "./ccpa-modal.js";
14-
import { TopBar } from "./topbar.js";
14+
import { TopBanner } from "./top-banner.js";
1515

1616
import queryString from "querystring";
1717

@@ -56,4 +56,4 @@ setupHighlighting();
5656
setupJwtCounter();
5757
setupShareJwtButton(shareJwtButton, shareJwtTextElement);
5858
CCPAModal();
59-
TopBar();
59+
TopBanner();

src/website/top-banner.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export function TopBanner() {
2+
document.addEventListener("DOMContentLoaded", function () {
3+
document.querySelector(".close-top-banner").addEventListener("click", () => {
4+
document.querySelector(".top-banner").classList.add('closed');
5+
document.querySelector(".top-banner-spacer").classList.add('hide');
6+
document.querySelector(".navbar").classList.remove("top-banner-open");
7+
});
8+
});
9+
}

src/website/topbar.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

stylus/website/index.styl

Lines changed: 93 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ body {
124124
height: 100px;
125125
}
126126

127-
&.top-bar-open {
128-
margin-top: 48px;
127+
&.top-banner-open {
128+
margin-top: 5px;
129+
transition: all 0.2s linear;
130+
+breakpoint('tablet') {
131+
margin-top: 48px;
132+
}
129133
}
130134

131135
.container {
@@ -1836,18 +1840,95 @@ footer {
18361840
color: rgb(0, 0, 0) !important;
18371841
}
18381842

1839-
.top-bar {
1840-
max-width: 1444px;
1841-
margin: 0 auto;
1843+
.top-banner {
1844+
background: linear-gradient(90deg, #ff4f40 0%, #ff44dd 99.99%);
1845+
border-radius: 8px;
1846+
max-width: 1440px;
1847+
padding: 8px 16px;
1848+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
18421849
visibility: visible;
18431850
opacity: 1;
1844-
height: 48px;
1851+
box-sizing: border-box;
1852+
margin: 0 auto;
1853+
position: absolute;
1854+
top: 12px;
1855+
z-index: 1000;
1856+
width: 100%;
1857+
left: 0;
1858+
right: 0;
1859+
overflow: hidden;
1860+
1861+
&.closed {
1862+
visibility: hidden;
1863+
height: 0;
1864+
opacity: 0;
1865+
padding: 0;
1866+
transition: all 0.2s linear;
1867+
}
1868+
1869+
.top-banner-container {
1870+
margin: 0 auto;
1871+
display: grid;
1872+
grid-template-columns: 1fr 30px;
1873+
max-width: 1200px;
1874+
align-items: center;
1875+
1876+
div {
1877+
+breakpoint('tablet') {
1878+
display: flex;
1879+
align-items: center;
1880+
}
1881+
}
1882+
}
1883+
1884+
p {
1885+
font-size: 14px;
1886+
color: #fff;
1887+
margin: 0 2rem 0 0;
1888+
display: inline;
1889+
}
1890+
1891+
a {
1892+
font-weight: 600;
1893+
font-size: 14px;
1894+
color: #fff;
1895+
text-decoration: none;
1896+
display: block;
1897+
1898+
span {
1899+
margin-left: 8px;
1900+
}
1901+
1902+
&:hover {
1903+
text-decoration: underline;
1904+
}
1905+
1906+
+breakpoint('tablet') {
1907+
display: inline;
1908+
}
1909+
}
1910+
1911+
button {
1912+
font-weight: 600;
1913+
font-size: 20px;
1914+
color: #fff;
1915+
text-decoration: none;
1916+
background: none;
1917+
border: none;
1918+
justify-self: flex-end;
1919+
display: block;
1920+
cursor: pointer;
1921+
text-align: right;
1922+
transform: rotate(45deg);
1923+
}
18451924
}
18461925

1847-
.top-bar.closed {
1848-
visibility: hidden;
1849-
height: 0;
1850-
opacity: 0;
1851-
padding: 0;
1852-
transition: all 0.2s linear;
1926+
.top-banner-spacer {
1927+
background: black;
1928+
height: 50px;
1929+
1930+
&.hide {
1931+
height: 0;
1932+
transition: all 0.2s linear;
1933+
}
18531934
}

views/website/navigation.pug

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
.top-bar
2-
.top-bar-container
3-
p Learn what's new with Auth0 at Devday23 on May 16
4-
a(href="https://developerday.com/register" target="_blank") Register now
5-
button +
1+
.top-banner
2+
.top-banner-container
3+
div
4+
p Learn what's new with Auth0 at Devday23 on May 16
5+
a(href="https://developerday.com/register" target="_blank") Register now
6+
span(aria-hiden="true")
7+
button.close-top-banner +
8+
9+
.top-banner-spacer
610

7-
nav.navbar.closed
11+
nav.navbar.closed.top-banner-open
812
.container
913
.top-mobile
1014
.menu-trigger

0 commit comments

Comments
 (0)