Skip to content

Commit d863569

Browse files
committedFeb 22, 2024
feature: tippy top banner code::identity
1 parent 822d643 commit d863569

File tree

5 files changed

+120
-2
lines changed

5 files changed

+120
-2
lines changed
 

‎.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 16.15.0

‎src/website/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
shareJwtTextElement,
1212
} from "./dom-elements.js";
1313
import { CCPAModal } from "./ccpa-modal.js";
14+
import { TopBanner } from "./top-banner.js";
1415

1516
import queryString from "querystring";
1617

@@ -54,4 +55,5 @@ parseLocationQuery();
5455
setupHighlighting();
5556
setupJwtCounter();
5657
setupShareJwtButton(shareJwtButton, shareJwtTextElement);
57-
CCPAModal();
58+
CCPAModal();
59+
TopBanner();

‎src/website/top-banner.js

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

‎stylus/website/index.styl

+93
Original file line numberDiff line numberDiff line change
@@ -1849,3 +1849,96 @@ footer {
18491849
height: 48px;
18501850
z-index: 100;
18511851
}
1852+
1853+
.top-banner {
1854+
background: linear-gradient(90deg, #ff4f40 0%, #ff44dd 99.99%);
1855+
border-radius: 8px;
1856+
max-width: 1216px;
1857+
padding: 8px 16px;
1858+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
1859+
visibility: visible;
1860+
opacity: 1;
1861+
box-sizing: border-box;
1862+
margin: 0 auto;
1863+
position: fixed;
1864+
top: 12px;
1865+
z-index: 1000;
1866+
width: 100%;
1867+
left: 0;
1868+
right: 0;
1869+
overflow: hidden;
1870+
1871+
&.closed {
1872+
visibility: hidden;
1873+
height: 0;
1874+
opacity: 0;
1875+
padding: 0;
1876+
transition: all 0.2s linear;
1877+
}
1878+
1879+
.top-banner-container {
1880+
margin: 0 auto;
1881+
display: grid;
1882+
grid-template-columns: 1fr 30px;
1883+
max-width: 1200px;
1884+
align-items: center;
1885+
1886+
div {
1887+
+breakpoint('tablet') {
1888+
display: flex;
1889+
align-items: center;
1890+
}
1891+
}
1892+
}
1893+
1894+
p {
1895+
font-size: 14px;
1896+
color: #fff;
1897+
margin: 0 2rem 0 0;
1898+
display: inline;
1899+
}
1900+
1901+
a {
1902+
font-weight: 600;
1903+
font-size: 14px;
1904+
color: #fff;
1905+
text-decoration: none;
1906+
display: block;
1907+
1908+
span {
1909+
margin-left: 8px;
1910+
}
1911+
1912+
&:hover {
1913+
text-decoration: underline;
1914+
}
1915+
1916+
+breakpoint('tablet') {
1917+
display: inline;
1918+
}
1919+
}
1920+
1921+
button {
1922+
font-weight: 600;
1923+
font-size: 20px;
1924+
color: #fff;
1925+
text-decoration: none;
1926+
background: none;
1927+
border: none;
1928+
justify-self: flex-end;
1929+
display: block;
1930+
cursor: pointer;
1931+
text-align: right;
1932+
transform: rotate(45deg);
1933+
}
1934+
}
1935+
1936+
.top-banner-spacer {
1937+
background: black;
1938+
height: 50px;
1939+
1940+
&.hide {
1941+
height: 0;
1942+
transition: all 0.2s linear;
1943+
}
1944+
}

‎views/website/navigation.pug

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
nav.navbar.closed
1+
.top-banner-bg
2+
.top-banner
3+
.top-banner-container
4+
div
5+
p Build your login box in minutes with Auth0.
6+
a(href="https://regionalevents.okta.com/soyouneedtobuildaloginbox/DeveloperCenter" target="_blank") Register for Code::Identity to learn how
7+
span(aria-hiden="true")
8+
button.close-top-banner +
9+
10+
.top-banner-spacer
11+
12+
nav.navbar.closed.top-banner-open
213
.container
314
.top-mobile
415
.menu-trigger

0 commit comments

Comments
 (0)
Please sign in to comment.