Skip to content

Commit 3b29720

Browse files
committed
seperated help updated header
1 parent f674234 commit 3b29720

File tree

10 files changed

+103
-38
lines changed

10 files changed

+103
-38
lines changed

src/assets/styles/dialog.css

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,52 @@
11
/* following :root block added by css color collector at 10/17/2024, 9:01:47 PM */
22
:root {
3-
--dialog__bg--1: rgb(0 0 0 / 0%);
4-
--dialog__bg--2: rgb(0 0 0 / 25%);
3+
--dialog__bg--1: rgb(0 0 0 / 0%);
4+
--dialog__bg--2: rgb(0 0 0 / 25%);
55
}
6+
7+
.help-dialog {
8+
padding: 1.5rem;
9+
border-radius: 8px;
10+
border: none;
11+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
12+
max-width: 400px;
13+
width: 90%;
14+
}
15+
16+
.dialog-header {
17+
display: flex;
18+
justify-content: space-between;
19+
align-items: center;
20+
margin-bottom: 1rem;
21+
}
22+
23+
.dialog-header h2 {
24+
margin: 0;
25+
font-size: 1.25rem;
26+
}
27+
28+
.dialog-header button {
29+
background: none;
30+
border: none;
31+
font-size: 1.5rem;
32+
cursor: pointer;
33+
padding: 0.25rem;
34+
border-radius: 50%;
35+
width: 32px;
36+
height: 32px;
37+
display: flex;
38+
align-items: center;
39+
justify-content: center;
40+
}
41+
42+
.dialog-header button:hover {
43+
background-color: rgba(0, 0, 0, 0.05);
44+
}
45+
46+
.dialog-content {
47+
line-height: 1.5;
48+
}
49+
650
dialog[open] {
751
opacity: 1;
852
transform: scaleY(1);

src/assets/styles/footer.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77

88
.footer__nav {
9-
@apply flex flex-col items-center justify-center gap-3 text-gray-700 underline underline-offset-2 dark:text-gray-500;
9+
@apply flex flex-col md:flex-row items-center justify-center gap-3 text-gray-700 underline underline-offset-2 dark:text-gray-500;
1010
}
1111

1212
.footer__nav--item {

src/assets/styles/header.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
@import url(./globals.css);
22

33
.header {
4+
position: fixed;
5+
top: 0;
6+
left: 0;
7+
width: 100%;
8+
z-index: 1000;
49
background-color: var(--background);
510
border-bottom: 1px solid var(--border);
611
height: var(--header-h);

src/assets/styles/menu.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@
210210
border-radius: 12px 12px 0 0;
211211
outline: 1px solid color-mix(in hsl, canvas, canvasText 25%);
212212
translate: 0 100%;
213-
position: sticky;
214213
}
215214

216215
[data-placement="bottom"] [popover] {

src/components/Help.astro

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
import "@/assets/styles/dialog.css";
3+
4+
interface Props {
5+
title: string;
6+
description: string;
7+
}
8+
9+
const { title, description } = Astro.props;
10+
---
11+
<div id="hint" class="hint">❓</div>
12+
<dialog id="info" class="help-dialog">
13+
<div class="dialog-header">
14+
<h2>{title}</h2>
15+
<button autofocus aria-label="Close dialog">×</button>
16+
</div>
17+
<div class="dialog-content">
18+
<p>{description}</p>
19+
</div>
20+
</dialog>
21+
22+
23+
<script>
24+
const hint = document.querySelector("#hint");
25+
const infoDialog = document.querySelector("dialog");
26+
const btn = document.querySelector("dialog > div > button");
27+
hint?.addEventListener("click", () => {
28+
infoDialog?.showModal();
29+
});
30+
btn?.addEventListener("click", () => {
31+
infoDialog?.close();
32+
});
33+
</script>

src/layouts/common/Header.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const { title, hasBack = true } = Astro.props;
2424
<slot name="right" />
2525
</div>
2626
</header>
27+
<div class="header-spacer"></div>
2728

2829
<style>
2930
.back {
@@ -43,4 +44,8 @@ const { title, hasBack = true } = Astro.props;
4344
:global(.action-group a) {
4445
white-space: nowrap;
4546
}
47+
48+
.header-spacer {
49+
height: var(--header-h);
50+
}
4651
</style>

src/pages/about.astro

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
11
---
22
import "@/assets/styles/about.css";
3-
import "@/assets/styles/dialog.css";
3+
import Help from "@/components/Help.astro";
44
import BaseLayout from "@/layouts/Base";
55
---
66

77
<BaseLayout meta={{ title: "About us" }}>
88
<Fragment slot="header-right">
9-
<div id="hint" class="hint">❓</div>
9+
<Help
10+
title="Hide & Seek Game"
11+
description="Press any alphabet key from keyboard and that letter will appears and when you press again then it will disappears. See some hover and active effects while hovering over each card."
12+
/>
1013
</Fragment>
11-
14+
1215
<main class="about-main">
1316
<div class="container__about">
14-
<h1>Hello There</h1>
1517
<section class="moto">
1618
<p>This is my initial version to make interactive games for kids</p>
1719
<p>
1820
Inspiration behind these games are to take kids away from smartphone and close to keyboard which will help in
1921
their future building also.
2022
</p>
2123
</section>
22-
<dialog id="info">
23-
<button autofocus>Close</button>
24-
<p>Hide & Seek.</p>
25-
<p>
26-
Press any alphabet key from keyboard and that letter will appears and when you press again then it will
27-
disappears. see some hover and active effect while hover over each card
28-
</p>
29-
</dialog>
3024
</div>
3125
</main>
3226
</BaseLayout>
33-
34-
<script>
35-
const hint = document.querySelector("#hint");
36-
const infoDialog = document.querySelector("dialog");
37-
const btn = document.querySelector("dialog > button");
38-
hint?.addEventListener("click", () => {
39-
infoDialog?.showModal();
40-
});
41-
btn?.addEventListener("click", () => {
42-
infoDialog?.close();
43-
});
44-
</script>

src/pages/panel.astro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@ import BaseLayout from "@/layouts/Base";
2020
</style>
2121

2222
<BaseLayout meta={{ title: "Panel" }}>
23-
<Fragment slot="header-right">
24-
<div id="hint" class="hint">❓</div>
25-
</Fragment>
26-
27-
<div class="tv panel-main">
23+
<article class="tv panel-main">
2824
<section class="scene">
2925
<letter-panel>
3026
<div class="panel" id="panel"></div>
3127
</letter-panel>
3228
</section>
33-
</div>
29+
</article>
3430
</BaseLayout>
3531
<script>
3632
enum ArrowKeys {

src/pages/sample.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import "@/assets/styles/page.css";
3+
import Help from "@/components/Help.astro";
34
import BaseLayout from "@/layouts/Base";
45
---
56

@@ -12,6 +13,10 @@ import BaseLayout from "@/layouts/Base";
1213
<button>Right 1</button>
1314
<button>Right 2</button>
1415
<button>Right 3</button>
16+
<Help
17+
title="Sample Page"
18+
description="This is a sample page to demonstrate the layout and features available in the project."
19+
/>
1520
</Fragment>
1621

1722
<main class="container__page">

src/pages/varnmala.astro

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { varnmala_english, varnmala_hindi } from "@/utils/common";
55
---
66

77
<BaseLayout meta={{ title: "Alphabets" }}>
8-
<Fragment slot="header-right">
9-
<div id="hint" class="hint">❓</div>
10-
</Fragment>
11-
128
<main class="varnmala-main">
139
<Alphabet list={varnmala_english} title="English" />
1410
<Alphabet list={varnmala_hindi} title="Hindi" />

0 commit comments

Comments
 (0)