Skip to content

Commit 4effe76

Browse files
committed
lookbook: add overlay dialog (WIP)
1 parent eb30b30 commit 4effe76

File tree

10 files changed

+133
-1
lines changed

10 files changed

+133
-1
lines changed

apps/lookbook/src/components/DemoNavBar.astro

+67-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,58 @@
11
---
22
import twopoint5d from '../images/twopoint5d-logo.svg?url';
3+
import CloseDialogIcon from './icons/CloseDialogIcon.astro';
4+
import CodeIcon from './icons/CodeIcon.astro';
5+
import HomeIcon from './icons/HomeIcon.astro';
36
---
47

58
<div class="absolute bottom-0 z-50 -rotate-90 origin-bottom-left transform-gpu container pointer-events-none">
69
<div class="flex justify-center">
7-
<header class="demo-navbar flex justify-start items-center px-1.5 lg:pe-5 lg:ps-4 h-10 backdrop-blur-sm pointer-events-auto">
10+
<header
11+
class="demo-navbar gap-2 flex justify-start items-center px-1.5 lg:pe-5 lg:ps-4 h-10 backdrop-blur-sm pointer-events-auto"
12+
>
813
<a href={import.meta.env.BASE_URL}>
914
<img class="primary" src={twopoint5d} alt="twopoint5d" />
1015
</a>
16+
<a href={import.meta.env.BASE_URL} class="interactive-action rotate-90">
17+
<HomeIcon />
18+
</a>
19+
<button class="interactive-action open-show-source-dialog-action rotate-90">
20+
<CodeIcon />
21+
</button>
1122
</header>
1223
</div>
1324
</div>
1425

26+
<dialog class="show-source-dialog p-4 rounded-md backdrop-blur-sm">
27+
<header class="flex flex-col items-end mb-2">
28+
<button autofocus>
29+
<CloseDialogIcon />
30+
</button>
31+
</header>
32+
<p class="text-xl">This modal dialog has a groovy backdrop!</p>
33+
</dialog>
34+
1535
<style>
36+
.show-source-dialog {
37+
background-color: rgba(18 22 25 / 75%);
38+
color: #fff;
39+
outline: 1px solid #ffe;
40+
box-shadow: 0 0 2px 3px rgba(0 0 0 / 20%);
41+
}
42+
43+
.show-source-dialog::backdrop {
44+
background: rgb(187, 0, 51);
45+
background: linear-gradient(
46+
22deg,
47+
rgba(187, 0, 51, 0.66) 0%,
48+
rgba(143, 0, 132, 0.66) 13%,
49+
rgba(8, 101, 92, 0.66) 61%,
50+
rgba(0, 96, 102, 0.66) 64%,
51+
rgba(0, 35, 97, 0.66) 86%,
52+
rgba(0, 2, 102, 0.66) 100%
53+
);
54+
}
55+
1656
.container {
1757
width: 100vh;
1858
height: 0;
@@ -22,10 +62,36 @@ import twopoint5d from '../images/twopoint5d-logo.svg?url';
2262
.demo-navbar {
2363
--bg-col: var(--color-demo-navbar-background, rgba(18 22 25 / 75%));
2464
background-color: var(--bg-col);
65+
color: #ddd;
2566
}
2667

2768
.demo-navbar img.primary {
2869
max-height: 32px;
2970
margin-left: 0.75rem;
71+
margin-right: 0.75rem;
72+
}
73+
74+
.interactive-action:hover {
75+
color: #fff;
76+
background-color: #333;
77+
border-radius: 2px;
78+
}
79+
80+
.interactive-action:focus-visible {
81+
outline: 0;
3082
}
3183
</style>
84+
85+
<script>
86+
const dialog = document.querySelector('dialog.show-source-dialog') as HTMLDialogElement;
87+
const closeButton = dialog.querySelector('button');
88+
const showButton = document.querySelector('button.open-show-source-dialog-action');
89+
90+
showButton.addEventListener('click', () => {
91+
dialog.showModal();
92+
});
93+
94+
closeButton.addEventListener('click', () => {
95+
dialog.close();
96+
});
97+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
import Icon from '../../images/iconoir/web-window-xmark-solid.svg?raw';
3+
---
4+
5+
<Fragment set:html={Icon} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
import Icon from '../../images/iconoir/code.svg?raw';
3+
---
4+
5+
<Fragment set:html={Icon} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
import Icon from '../../images/iconoir/undo.svg?raw';
3+
---
4+
5+
<Fragment set:html={Icon} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
import Icon from '../../images/iconoir/info-circle.svg?raw';
3+
---
4+
5+
<Fragment set:html={Icon} />
+10
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)