Skip to content

Commit 195e82f

Browse files
committed
lookbook: improve show source dialog
1 parent 47b00a6 commit 195e82f

File tree

4 files changed

+58
-14
lines changed

4 files changed

+58
-14
lines changed

apps/lookbook/src/components/DemoNavBar.astro

+38-13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import twopoint5d from '../images/twopoint5d-logo.svg?url';
33
import CloseDialogIcon from './icons/CloseDialogIcon.astro';
44
import CodeIcon from './icons/CodeIcon.astro';
5+
import GitHubInvertocatIcon from './icons/GitHubInvertocatIcon.astro';
56
import HomeIcon from './icons/HomeIcon.astro';
67
---
78

@@ -10,33 +11,56 @@ import HomeIcon from './icons/HomeIcon.astro';
1011
<header
1112
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"
1213
>
13-
<a href={import.meta.env.BASE_URL}>
14-
<img class="primary" src={twopoint5d} alt="twopoint5d" />
15-
</a>
1614
<a href={import.meta.env.BASE_URL} class="interactive-action rotate-90">
1715
<HomeIcon />
1816
</a>
17+
<button class="interactive-action open-show-source-dialog-action">
18+
<img class="primary" src={twopoint5d} alt="twopoint5d" />
19+
</button>
1920
<button class="interactive-action open-show-source-dialog-action rotate-90">
2021
<CodeIcon />
2122
</button>
2223
</header>
2324
</div>
2425
</div>
2526

26-
<dialog class="show-source-dialog p-4 rounded-md backdrop-blur-sm">
27-
<header class="flex flex-col items-end mb-2">
27+
<dialog class="show-source-dialog px-6 py-4 rounded-md backdrop-blur-sm">
28+
<header class="flex flex-row items-center justify-between mb-4">
29+
<figure class="flex items-center justify-start text-slate-300">
30+
<figcaption>a</figcaption>
31+
<a href={import.meta.env.BASE_URL}>
32+
<img class="h-8" src={twopoint5d} alt="twopoint5d" />
33+
</a>
34+
<figcaption>demo</figcaption>
35+
</figure>
2836
<button autofocus>
2937
<CloseDialogIcon />
3038
</button>
3139
</header>
32-
<p class="text-xl">This modal dialog has a groovy backdrop!</p>
40+
<section>
41+
<h2 class="text-2xl">Explore Source Code</h2>
42+
<p class="text-sm">Want to see how it is done?</p>
43+
<ul class="mt-4 mb-6">
44+
<li class="ring-1 ring-white rounded-md hover:bg-slate-800">
45+
<a class="flex flex-row justify-center items-center text-sm py-2 gap-2" href="">
46+
<GitHubInvertocatIcon class="h-10" />
47+
<span>Show source on GitHub</span>
48+
</a>
49+
</li>
50+
</ul>
51+
<a class="block mb-1 text-xs text-center text-slate-400 underline" href="https://github.com/spearwolf/twopoint5d"
52+
>Just take me to the project repository</a
53+
>
54+
<a class="block mb-1 text-xs text-center text-slate-400 underline" href={import.meta.env.BASE_URL}>Explore LookBook</a>
55+
</section>
3356
</dialog>
3457

3558
<style>
3659
.show-source-dialog {
60+
min-width: 320px;
3761
background-color: rgba(18 22 25 / 75%);
3862
color: #fff;
39-
outline: 1px solid #ffe;
63+
outline: 1px solid #e5e500;
4064
box-shadow: 0 0 2px 3px rgba(0 0 0 / 20%);
4165
}
4266

@@ -51,6 +75,7 @@ import HomeIcon from './icons/HomeIcon.astro';
5175
rgba(0, 35, 97, 0.66) 86%,
5276
rgba(0, 2, 102, 0.66) 100%
5377
);
78+
backdrop-filter: blur(2px);
5479
}
5580

5681
.container {
@@ -67,8 +92,6 @@ import HomeIcon from './icons/HomeIcon.astro';
6792

6893
.demo-navbar img.primary {
6994
max-height: 32px;
70-
margin-left: 0.75rem;
71-
margin-right: 0.75rem;
7295
}
7396

7497
.interactive-action:hover {
@@ -85,11 +108,13 @@ import HomeIcon from './icons/HomeIcon.astro';
85108
<script>
86109
const dialog = document.querySelector('dialog.show-source-dialog') as HTMLDialogElement;
87110
const closeButton = dialog.querySelector('button');
88-
const showButton = document.querySelector('button.open-show-source-dialog-action');
111+
const showButtons = document.querySelectorAll('button.open-show-source-dialog-action');
89112

90-
showButton.addEventListener('click', () => {
91-
dialog.showModal();
92-
});
113+
for (const showButton of showButtons) {
114+
showButton.addEventListener('click', () => {
115+
dialog.showModal();
116+
});
117+
}
93118

94119
closeButton.addEventListener('click', () => {
95120
dialog.close();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
import Icon from '../../images/github-mark-white.svg?raw';
3+
4+
const {class: classes} = Astro.props;
5+
---
6+
7+
<div class={classes}>
8+
<Fragment set:html={Icon} />
9+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
import Icon from '../../images/iconoir/undo.svg?raw';
3+
4+
const {class: classes} = Astro.props;
35
---
46

5-
<Fragment set:html={Icon} />
7+
<div class={classes}>
8+
<Fragment set:html={Icon} />
9+
</div>
Loading

0 commit comments

Comments
 (0)