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
31 changes: 31 additions & 0 deletions src/Elastic.Markdown/Assets/archive.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#delorean {
transition: transform 1500ms linear; /* Use transform translate */
}

.screen-flash {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s ease-out;
z-index: 15;
}

.screen-flash.show {
opacity: 1;
}

@keyframes flash-colors {
0% {
background-color: rgba(255, 255, 255, 0.8);
}
50% {
background-color: rgb(255, 255, 0, 0.9);
}
100% {
background-color: rgba(255, 255, 255, 0.8);
}
}
2 changes: 2 additions & 0 deletions src/Elastic.Markdown/Assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@import './markdown/definition-list.css';
@import './markdown/images.css';
@import './modal.css';
@import './archive.css';

:root {
--outline-size: max(2px, 0.08em);
Expand Down Expand Up @@ -188,6 +189,7 @@
}

body {
min-height: 100vh;
display: grid;
grid-template-rows: auto auto 1fr auto;
}
Expand Down
37 changes: 35 additions & 2 deletions src/Elastic.Markdown/Slices/Layout/_Archive.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@inherits RazorSlice<LayoutViewModel>

<div class="bg-[#F5F7FA] w-full px-8 py-16 text-center">
<div class="container mx-auto mt-20">
<h1 class="text-4xl md:text-6xl">Documentation archive</h1>
Expand All @@ -11,7 +10,7 @@
</div>
<div style="background-image: url(@(Model.Static("delorean-bg.png"))"
class="delorean-background bg-center bg-repeat-x w-full h-30 bg-blue-developer py-6 flex items-center justify-center">
<img src="@Model.Static("delorean.png")" alt="" width="200" class="delorean">
<img id="delorean" src="@Model.Static("delorean.png")" alt="" width="200" class="delorean">
</div>
<div class="bg-blue-developer text-white size-full px-8 py-16">
<div class="container mx-auto">
Expand Down Expand Up @@ -329,3 +328,37 @@
</a>
</div>
</div>
<script type="module">
const delorean = document.getElementById('delorean');
let isTraveling = false;
delorean.addEventListener('click', () => {
if (!isTraveling) {
isTraveling = true;
delorean.style.transform = `translateX(calc(100vw - 50px))`;
const flashPattern = [300, 150, 600, 200, 50, 50, 50, 50, 50]; // Milliseconds delays
let totalDelay = 0;
flashPattern.forEach(delay => {
totalDelay += delay;
setTimeout(() => {
createScreenFlash();
}, totalDelay);
});
setTimeout(() => {
window.location.assign('@Model.Link("/")')
}, 1500);
}
});

function createScreenFlash() {
const flash = document.createElement('div');
flash.className = 'screen-flash';
flash.style.animation = 'flash-colors 0.4s ease-in-out';
document.body.appendChild(flash);
setTimeout(() => {
flash.classList.add('show');
setTimeout(() => {
flash.remove();
}, 400);
});
}
</script>
7 changes: 6 additions & 1 deletion src/Elastic.Markdown/Slices/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<!DOCTYPE html>
<html lang="en" class="h-screen">
@await RenderPartialAsync(_Head.Create(Model))

@{
var layout = Model.CurrentDocument.YamlFrontMatter?.Layout;
}

<body
class="group/body text-ink has-[#primary-nav-hamburger:checked]:overflow-hidden"
hx-ext="preload, head-support"
Expand Down Expand Up @@ -39,7 +44,7 @@
</div>
}
}
@switch (Model.CurrentDocument.YamlFrontMatter?.Layout)
@switch (layout)
{
case LayoutName.NotFound:
await RenderPartialAsync(_NotFound.Create(Model));
Expand Down
Loading