File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change
1
+ export function initDismissibleBanner ( ) {
2
+ const banner = document . getElementById ( 'dismissible-banner' )
3
+ const dismissButton = document . getElementById ( 'dismissible-button' )
4
+
5
+ if ( ! localStorage . getItem ( 'bannerDismissed' ) ) {
6
+ banner ?. style . setProperty ( 'display' , 'flex' )
7
+ }
8
+
9
+ dismissButton ?. addEventListener ( 'click' , ( ) => {
10
+ banner ?. style . setProperty ( 'display' , 'none' )
11
+ localStorage . setItem ( 'bannerDismissed' , 'true' )
12
+ } )
13
+ }
Original file line number Diff line number Diff line change 1
1
import { initCopyButton } from './copybutton'
2
+ import { initDismissibleBanner } from './dismissible-banner'
2
3
import { initHighlight } from './hljs'
3
4
import { openDetailsWithAnchor } from './open-details-with-anchor'
4
5
import { initNav } from './pages-nav'
@@ -21,6 +22,7 @@ document.addEventListener('htmx:load', function () {
21
22
initNav ( )
22
23
initSmoothScroll ( )
23
24
openDetailsWithAnchor ( )
25
+ initDismissibleBanner ( )
24
26
} )
25
27
26
28
// Don't remove style tags because they are used by the elastic global nav.
Original file line number Diff line number Diff line change @@ -248,3 +248,14 @@ body {
248
248
# pages-nav details > summary ::-webkit-details-marker {
249
249
display : none;
250
250
}
251
+
252
+ # dismissible-banner {
253
+ @apply font-body sticky bottom-0 z-50 mt-0 hidden flex-row items-center justify-between p-4 text-sm;
254
+ }
255
+
256
+ # dismissible-button {
257
+ @apply text-blue-developer text-base font-bold;
258
+ & : hover {
259
+ @apply bg-grey-20 rounded-2xl;
260
+ }
261
+ }
Original file line number Diff line number Diff line change 1
1
@using Elastic .Markdown .Myst .FrontMatter
2
2
@inherits RazorLayoutSlice <LayoutViewModel >
3
3
<!DOCTYPE html>
4
- <html lang =" en" class =" h-screen" >
4
+ <html lang =" en" class =" h-screen" xmlns = " http://www.w3.org/1999/html " >
5
5
@await RenderPartialAsync(_Head.Create(Model))
6
6
7
7
@{
20
20
@( await RenderPartialAsync (_Header .Create (Model )))
21
21
<div id =" main-container" class =" flex flex-col items-center border-t-1 border-grey-20" >
22
22
@functions {
23
+
23
24
private async Task DefaultLayout ()
24
25
{
25
26
<div class =" container h-full grid gap-2 grid-cols-1 md:grid-cols-[calc(var(--spacing)*65)_auto] lg:grid-cols-[calc(var(--spacing)*65)_auto_calc(var(--spacing)*50)] px-6" >
43
44
</main >
44
45
</div >
45
46
}
47
+
46
48
}
49
+
47
50
@switch (layout)
48
51
{
49
52
case LayoutName .NotFound :
61
64
}
62
65
</div >
63
66
@await RenderPartialAsync(_Footer.Create(Model))
67
+ <aside id =" dismissible-banner" class =" admonition note" >
68
+ <div class =" container flex justify-between items-center mx-auto" >
69
+ <p >
70
+ You are viewing the new Elastic Docs experience for the latest product versions.
71
+ If the page exists in older docs, you can click <strong >View previous version</strong >.
72
+ </p >
73
+ <button id =" dismissible-button" >
74
+ <svg xmlns =" http://www.w3.org/2000/svg" fill =" none" viewBox =" 0 0 24 24" stroke-width =" 1.5" stroke =" currentColor" class =" size-6" >
75
+ <path stroke-linecap =" round" stroke-linejoin =" round" d =" M6 18 18 6M6 6l12 12" />
76
+ </svg >
77
+ </button >
78
+ </div >
79
+ </aside >
64
80
</body >
65
81
</html >
You can’t perform that action at this time.
0 commit comments