astro-theme-popular 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -0
  3. package/index.mjs +81 -0
  4. package/package.json +47 -0
  5. package/schemas.ts +137 -0
  6. package/scripts/blog-filter.js +24 -0
  7. package/scripts/checklist.js +42 -0
  8. package/scripts/copy-code.js +25 -0
  9. package/scripts/nav.js +12 -0
  10. package/scripts/toc.js +25 -0
  11. package/src/components/AuthorBox.astro +51 -0
  12. package/src/components/Callout.astro +22 -0
  13. package/src/components/Checklist.astro +29 -0
  14. package/src/components/DemoBar.astro +50 -0
  15. package/src/components/EventRow.astro +59 -0
  16. package/src/components/Footer.astro +42 -0
  17. package/src/components/Header.astro +49 -0
  18. package/src/components/OrganizerCard.astro +21 -0
  19. package/src/components/PageHero.astro +19 -0
  20. package/src/components/Pagination.astro +35 -0
  21. package/src/components/PostCard.astro +36 -0
  22. package/src/layouts/BaseLayout.astro +102 -0
  23. package/src/lib/slugs.ts +10 -0
  24. package/src/pages/[slug].astro +62 -0
  25. package/src/pages/authors/[slug].astro +39 -0
  26. package/src/pages/blog/[...page].astro +52 -0
  27. package/src/pages/blog/[slug].astro +122 -0
  28. package/src/pages/events/[...page].astro +86 -0
  29. package/src/pages/events/[slug].astro +81 -0
  30. package/src/pages/index.astro +178 -0
  31. package/src/pages/organizers/[...page].astro +38 -0
  32. package/src/pages/rss.xml.js +33 -0
  33. package/src/pages/speakers/[slug].astro +39 -0
  34. package/src/pages/tags/[tag]/[...page].astro +47 -0
  35. package/src/pages/venues/[slug].astro +50 -0
  36. package/src/styles/base.css +113 -0
  37. package/src/styles/components.css +310 -0
  38. package/src/styles/tokens/colors.css +82 -0
  39. package/src/styles/tokens/elevation.css +27 -0
  40. package/src/styles/tokens/fonts.css +9 -0
  41. package/src/styles/tokens/spacing.css +39 -0
  42. package/src/styles/tokens/typography.css +43 -0
  43. package/tsconfig.json +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mariatta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # astro-theme-popular
2
+
3
+ **Popular** is a warm, community-first Astro theme for meetups, clubs and fan
4
+ communities: events with venues and speakers, a multi-author blog, organizer
5
+ docs with persistent checklists, and one-block re-theming, shipped as an
6
+ Astro integration.
7
+
8
+ ```bash
9
+ npm install astro-theme-popular
10
+ ```
11
+
12
+ ```js
13
+ // astro.config.mjs
14
+ import { defineConfig } from 'astro/config';
15
+ import mdx from '@astrojs/mdx';
16
+ import popular from 'astro-theme-popular';
17
+
18
+ export default defineConfig({
19
+ site: 'https://your.community',
20
+ integrations: [mdx(), popular()],
21
+ });
22
+ ```
23
+
24
+ Your site keeps its own content (`src/content/`) and one typed config file
25
+ (`popular.config.ts`); the theme injects the routes, layouts, styles and
26
+ behavior. Adopt the content model in one line:
27
+
28
+ ```ts
29
+ // src/content.config.ts
30
+ export { collections } from 'astro-theme-popular/schemas';
31
+ ```
32
+
33
+ - **Docs & feature guides**: https://mariatta.ca/hugo-theme-popular/
34
+ - **Demos** (three fictional communities + one superfan personal site):
35
+ https://mariatta.ca/astro-theme-popular/
36
+ - **Changelog & releases**: https://github.com/Mariatta/astro-theme-popular/releases
37
+ - **Hugo twin** (same design system, full parity):
38
+ https://github.com/Mariatta/hugo-theme-popular
39
+
40
+ Popular is MIT licensed and named after the song *Pop!ular* by Darren Hayes.
package/index.mjs ADDED
@@ -0,0 +1,81 @@
1
+ /** Popular: Astro integration entry.
2
+ *
3
+ * import popular from 'astro-theme-popular';
4
+ * export default defineConfig({
5
+ * site: 'https://your.community',
6
+ * integrations: [mdx(), popular()],
7
+ * });
8
+ *
9
+ * Theme config (SITE, STRINGS, BRAND, NAV, ...) lives in the adopter's
10
+ * `popular.config.ts` (same named exports as the classic src/config.ts;
11
+ * the shape is the parity contract, see PARITY.md). Theme code reads it
12
+ * through the `popular:config` virtual module.
13
+ */
14
+ import path from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
16
+
17
+ const PAGES = [
18
+ ['/', 'index.astro'],
19
+ ['/[slug]', '[slug].astro'],
20
+ ['/authors/[slug]', 'authors/[slug].astro'],
21
+ ['/blog/[...page]', 'blog/[...page].astro'],
22
+ ['/blog/[slug]', 'blog/[slug].astro'],
23
+ ['/events/[...page]', 'events/[...page].astro'],
24
+ ['/events/[slug]', 'events/[slug].astro'],
25
+ ['/organizers/[...page]', 'organizers/[...page].astro'],
26
+ ['/speakers/[slug]', 'speakers/[slug].astro'],
27
+ ['/venues/[slug]', 'venues/[slug].astro'],
28
+ ['/tags/[tag]/[...page]', 'tags/[tag]/[...page].astro'],
29
+ ['/rss.xml', 'rss.xml.js'],
30
+ ];
31
+
32
+ export default function popular(options = {}) {
33
+ const configFile = options.configFile ?? './popular.config.ts';
34
+ return {
35
+ name: 'astro-theme-popular',
36
+ hooks: {
37
+ 'astro:config:setup': ({ config, injectRoute, injectScript, updateConfig, addWatchFile }) => {
38
+ const root = fileURLToPath(config.root);
39
+ const userConfig = path.resolve(root, configFile);
40
+ addWatchFile(userConfig);
41
+ updateConfig({
42
+ vite: {
43
+ plugins: [
44
+ {
45
+ name: 'popular:config',
46
+ resolveId(id) {
47
+ if (id === 'popular:config') return '\0popular:config';
48
+ },
49
+ load(id) {
50
+ if (id === '\0popular:config') {
51
+ return `export * from ${JSON.stringify(userConfig)};`;
52
+ }
53
+ },
54
+ },
55
+ ],
56
+ },
57
+ });
58
+ // Behavior JS (Tier-1 shared files, byte-identical with the Hugo
59
+ // repo). Injected as one bundled page script: hashed, deduplicated,
60
+ // loaded once per page like the classic <script defer> tags.
61
+ injectScript(
62
+ 'page',
63
+ [
64
+ 'nav',
65
+ 'checklist',
66
+ 'toc',
67
+ 'blog-filter',
68
+ 'copy-code',
69
+ ].map((s) => `import 'astro-theme-popular/scripts/${s}.js';`).join('\n'),
70
+ );
71
+ for (const [pattern, entry] of PAGES) {
72
+ injectRoute({
73
+ pattern,
74
+ entrypoint: `astro-theme-popular/pages/${entry}`,
75
+ prerender: true,
76
+ });
77
+ }
78
+ },
79
+ },
80
+ };
81
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "astro-theme-popular",
3
+ "version": "0.3.0",
4
+ "description": "Popular: a warm, community-first Astro theme for meetups, clubs and fan communities. Ships as an Astro integration.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Mariatta",
8
+ "homepage": "https://mariatta.ca/hugo-theme-popular/",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Mariatta/astro-theme-popular.git"
12
+ },
13
+ "keywords": [
14
+ "astro-integration",
15
+ "astro-theme",
16
+ "community",
17
+ "meetup",
18
+ "events"
19
+ ],
20
+ "exports": {
21
+ ".": "./index.mjs",
22
+ "./schemas": "./schemas.ts",
23
+ "./pages/*": "./src/pages/*",
24
+ "./components/*": "./src/components/*",
25
+ "./layouts/*": "./src/layouts/*",
26
+ "./styles/*": "./src/styles/*",
27
+ "./scripts/*": "./scripts/*"
28
+ },
29
+ "dependencies": {
30
+ "@astrojs/rss": "^4.0.0"
31
+ },
32
+ "peerDependencies": {
33
+ "astro": "^7.0.0"
34
+ },
35
+ "files": [
36
+ "index.mjs",
37
+ "schemas.ts",
38
+ "src",
39
+ "scripts",
40
+ "tsconfig.json",
41
+ "README.md",
42
+ "LICENSE"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }
package/schemas.ts ADDED
@@ -0,0 +1,137 @@
1
+ import { defineCollection, z } from 'astro:content';
2
+ import { glob } from 'astro/loaders';
3
+
4
+ /** Front-matter schemas: kept 1:1 compatible with the Hugo theme (see PARITY.md). */
5
+
6
+ const blog = defineCollection({
7
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
8
+ schema: z.object({
9
+ title: z.string(),
10
+ date: z.coerce.date(),
11
+ draft: z.boolean().default(false), // drafts are excluded from builds, matching Hugo
12
+ author: z.string().optional(), // simple byline fallback
13
+ authors: z.array(z.string()).default([]), // slugs of entries in the authors collection
14
+ guestAuthors: z
15
+ .array(
16
+ z.object({
17
+ name: z.string(),
18
+ title: z.string().optional(),
19
+ photo: z.string().optional(),
20
+ bio: z.string().optional(),
21
+ website: z.string().optional(),
22
+ social: z.array(z.object({ label: z.string(), icon: z.string(), url: z.string() })).default([]),
23
+ })
24
+ )
25
+ .default([]),
26
+ description: z.string().optional(),
27
+ image: z.string().optional(),
28
+ tags: z.array(z.string()).default([]),
29
+ speaker: z
30
+ .object({
31
+ name: z.string(),
32
+ title: z.string().optional(),
33
+ photo: z.string().optional(),
34
+ bio: z.string().optional(),
35
+ })
36
+ .optional(),
37
+ }),
38
+ });
39
+
40
+ const events = defineCollection({
41
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/events' }),
42
+ schema: z.object({
43
+ title: z.string(),
44
+ date: z.coerce.date(), // the event's start time; upcoming vs past is decided by this
45
+ draft: z.boolean().default(false), // drafts are excluded from builds, matching Hugo
46
+ description: z.string().optional(),
47
+ image: z.string().optional(),
48
+ tags: z.array(z.string()).default([]),
49
+ time: z.string().optional(),
50
+ venue: z.string().optional(),
51
+ venueWanted: z.boolean().default(false),
52
+ address: z.string().optional(),
53
+ speaker: z.string().optional(), // one-liner fallback when no speaker profiles are referenced
54
+ speakers: z.array(z.string()).default([]), // slugs of entries in the speakers collection
55
+ venueRef: z.string().optional(), // slug of a venues-collection entry; wins over the flat venue fields
56
+ checkin: z.string().optional(), // e.g. "Bring your registration email (print or phone) and photo ID."
57
+ venueNotes: z.string().optional(), // e.g. "Buzz 204 at the side door."; overrides the venue page's notes
58
+ rsvp: z.string().optional(),
59
+ meetupUrl: z.string().optional(), // metadata convention; the theme renders no external links on event rows
60
+ }),
61
+ });
62
+
63
+ const organizers = defineCollection({
64
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/organizers' }),
65
+ schema: z.object({
66
+ title: z.string(),
67
+ weight: z.number().default(100),
68
+ role: z.string().optional(),
69
+ photo: z.string().optional(),
70
+ description: z.string().optional(),
71
+ social: z
72
+ .array(z.object({ label: z.string(), icon: z.string(), url: z.string() }))
73
+ .default([]),
74
+ }),
75
+ });
76
+
77
+ /** Author profiles: referenced from blog posts via `authors: [slug]`. */
78
+ const authors = defineCollection({
79
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/authors' }),
80
+ schema: z.object({
81
+ title: z.string(), // the author's name
82
+ role: z.string().optional(),
83
+ photo: z.string().optional(),
84
+ bio: z.string().optional(),
85
+ website: z.string().optional(),
86
+ social: z.array(z.object({ label: z.string(), icon: z.string(), url: z.string() })).default([]),
87
+ }),
88
+ });
89
+
90
+ /** Speaker profiles: referenced from events via `speakers: [slug]`. */
91
+ const speakers = defineCollection({
92
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/speakers' }),
93
+ schema: z.object({
94
+ title: z.string(), // the speaker's name
95
+ role: z.string().optional(),
96
+ photo: z.string().optional(),
97
+ bio: z.string().optional(),
98
+ website: z.string().optional(),
99
+ social: z.array(z.object({ label: z.string(), icon: z.string(), url: z.string() })).default([]),
100
+ }),
101
+ });
102
+
103
+ /** Venue pages: referenced from events via `venueRef: slug`. */
104
+ const venues = defineCollection({
105
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/venues' }),
106
+ schema: z.object({
107
+ title: z.string(), // the venue's name
108
+ address: z.string().optional(),
109
+ photo: z.string().optional(),
110
+ notes: z.string().optional(), // arrival notes inherited by events held here
111
+ accessibility: z.string().optional(),
112
+ website: z.string().optional(),
113
+ }),
114
+ });
115
+
116
+ /** Long-form docs (handbook, runbooks), MDX with Callout/Checklist components. */
117
+ const docs = defineCollection({
118
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/docs' }),
119
+ schema: z.object({
120
+ title: z.string(),
121
+ eyebrow: z.string().optional(),
122
+ lead: z.string().optional(),
123
+ weight: z.number().default(100), // sidebar order, matching Hugo's weight
124
+ }),
125
+ });
126
+
127
+ /** Simple prose pages (about, code of conduct, get involved). */
128
+ const pages = defineCollection({
129
+ loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/pages' }),
130
+ schema: z.object({
131
+ title: z.string(),
132
+ eyebrow: z.string().optional(),
133
+ lead: z.string().optional(),
134
+ }),
135
+ });
136
+
137
+ export const collections = { blog, events, organizers, authors, speakers, venues, docs, pages };
@@ -0,0 +1,24 @@
1
+ /* Popular: client-side tag filter for the blog list.
2
+ Buttons [data-filter] show/hide [data-tags] cards. */
3
+ (function () {
4
+ document.addEventListener("DOMContentLoaded", function () {
5
+ var bar = document.querySelector("[data-filterbar]");
6
+ if (!bar) return;
7
+ var buttons = Array.prototype.slice.call(bar.querySelectorAll("[data-filter]"));
8
+ var cards = Array.prototype.slice.call(document.querySelectorAll("[data-tags]"));
9
+ buttons.forEach(function (b) { b.setAttribute("aria-pressed", b.classList.contains("is-active") ? "true" : "false"); });
10
+ buttons.forEach(function (btn) {
11
+ btn.addEventListener("click", function () {
12
+ var f = btn.getAttribute("data-filter");
13
+ buttons.forEach(function (b) {
14
+ b.classList.toggle("is-active", b === btn);
15
+ b.setAttribute("aria-pressed", b === btn ? "true" : "false");
16
+ });
17
+ cards.forEach(function (card) {
18
+ var tags = (card.getAttribute("data-tags") || "").split(",");
19
+ card.style.display = (f === "*" || tags.indexOf(f) !== -1) ? "" : "none";
20
+ });
21
+ });
22
+ });
23
+ });
24
+ })();
@@ -0,0 +1,42 @@
1
+ /* Popular: persistent runbook checklists.
2
+ Any .g-checklist with a data-key gets its tick state saved to
3
+ localStorage so organizers can close the tab and resume. */
4
+ (function () {
5
+ function initChecklist(root) {
6
+ var key = root.getAttribute("data-key") || "";
7
+ var items = Array.prototype.slice.call(root.querySelectorAll(".g-check"));
8
+ var countEl = root.querySelector(".g-checklist__count");
9
+ var state = {};
10
+ try { state = JSON.parse(localStorage.getItem("popular-check:" + key) || "{}"); } catch (e) {}
11
+
12
+ function render() {
13
+ var done = 0;
14
+ items.forEach(function (btn, i) {
15
+ var on = !!state[i];
16
+ btn.classList.toggle("is-done", on);
17
+ var box = btn.querySelector(".g-check__box");
18
+ if (box) box.innerHTML = on ? '<i class="fa-solid fa-check" aria-hidden="true"></i>' : "";
19
+ btn.setAttribute("aria-checked", on ? "true" : "false");
20
+ if (on) done++;
21
+ });
22
+ if (countEl) {
23
+ countEl.textContent = done + "/" + items.length + " " + (document.body.getAttribute("data-checklist-done") || "done");
24
+ countEl.classList.toggle("is-complete", done === items.length && items.length > 0);
25
+ }
26
+ }
27
+
28
+ if (countEl) countEl.setAttribute("aria-live", "polite");
29
+ items.forEach(function (btn, i) {
30
+ btn.setAttribute("role", "checkbox");
31
+ btn.addEventListener("click", function () {
32
+ state[i] = !state[i];
33
+ try { localStorage.setItem("popular-check:" + key, JSON.stringify(state)); } catch (e) {}
34
+ render();
35
+ });
36
+ });
37
+ render();
38
+ }
39
+ document.addEventListener("DOMContentLoaded", function () {
40
+ document.querySelectorAll(".g-checklist[data-key]").forEach(initChecklist);
41
+ });
42
+ })();
@@ -0,0 +1,25 @@
1
+ /* Popular: copy button on fenced code blocks. */
2
+ (function () {
3
+ document.addEventListener("DOMContentLoaded", function () {
4
+ if (!navigator.clipboard) return;
5
+ document.querySelectorAll("pre > code").forEach(function (code) {
6
+ var pre = code.parentElement;
7
+ var btn = document.createElement("button");
8
+ btn.className = "g-copy";
9
+ btn.type = "button";
10
+ btn.setAttribute("aria-label", document.body.getAttribute("data-copy-label") || "Copy code");
11
+ btn.innerHTML = '<i class="fa-regular fa-copy" aria-hidden="true"></i>';
12
+ btn.addEventListener("click", function () {
13
+ navigator.clipboard.writeText(code.innerText).then(function () {
14
+ btn.classList.add("is-copied");
15
+ btn.innerHTML = '<i class="fa-solid fa-check" aria-hidden="true"></i>';
16
+ setTimeout(function () {
17
+ btn.classList.remove("is-copied");
18
+ btn.innerHTML = '<i class="fa-regular fa-copy" aria-hidden="true"></i>';
19
+ }, 1600);
20
+ });
21
+ });
22
+ pre.appendChild(btn);
23
+ });
24
+ });
25
+ })();
package/scripts/nav.js ADDED
@@ -0,0 +1,12 @@
1
+ /* Popular: mobile nav toggle. */
2
+ (function () {
3
+ document.addEventListener("DOMContentLoaded", function () {
4
+ var toggle = document.querySelector(".g-nav__toggle");
5
+ var links = document.querySelector(".g-navlinks");
6
+ if (!toggle || !links) return;
7
+ toggle.addEventListener("click", function () {
8
+ var open = links.classList.toggle("is-open");
9
+ toggle.setAttribute("aria-expanded", open ? "true" : "false");
10
+ });
11
+ });
12
+ })();
package/scripts/toc.js ADDED
@@ -0,0 +1,25 @@
1
+ /* Popular: scroll-spy for the docs table of contents.
2
+ Highlights the .g-doc-toc link whose section is in view. */
3
+ (function () {
4
+ document.addEventListener("DOMContentLoaded", function () {
5
+ var toc = document.querySelector(".g-doc-toc");
6
+ if (!toc) return;
7
+ var links = Array.prototype.slice.call(toc.querySelectorAll("a[href^='#']"));
8
+ if (!links.length) return;
9
+ var map = {};
10
+ var targets = [];
11
+ links.forEach(function (a) {
12
+ var id = a.getAttribute("href").slice(1);
13
+ var el = document.getElementById(id);
14
+ if (el) { map[id] = a; targets.push(el); }
15
+ });
16
+ function setActive(id) {
17
+ links.forEach(function (a) { a.classList.toggle("is-active", a === map[id]); });
18
+ }
19
+ var obs = new IntersectionObserver(function (entries) {
20
+ entries.forEach(function (e) { if (e.isIntersecting) setActive(e.target.id); });
21
+ }, { rootMargin: "-30% 0px -60% 0px", threshold: 0 });
22
+ targets.forEach(function (t) { obs.observe(t); });
23
+ if (targets[0]) setActive(targets[0].id);
24
+ });
25
+ })();
@@ -0,0 +1,51 @@
1
+ ---
2
+ import { STRINGS } from 'popular:config';
3
+ /** AuthorBox: bio card for a post author.
4
+ * Pass either `entry` (an authors-collection entry, linked to its profile)
5
+ * or `guest` (inline guestAuthors object from a post's front matter). */
6
+ import type { CollectionEntry } from 'astro:content';
7
+
8
+ interface Guest {
9
+ name: string; title?: string; photo?: string; bio?: string; website?: string;
10
+ social?: { label: string; icon: string; url: string }[];
11
+ }
12
+ interface Props {
13
+ entry?: CollectionEntry<'authors'> | CollectionEntry<'speakers'>;
14
+ guest?: Guest;
15
+ /** Profile URL prefix; speakers pass '/speakers/'. */
16
+ base?: string;
17
+ }
18
+ const { entry, guest, base = '/authors/' } = Astro.props;
19
+ const d = entry?.data;
20
+ ---
21
+
22
+ <div class="g-persona g-persona--primary">
23
+ {d && (
24
+ <>
25
+ {d.photo && <img class="g-persona__img" src={d.photo} alt={entry.data.title} />}
26
+ <div>
27
+ <div class="g-persona__name"><a href={`${base}${entry.id}/`} style="color:inherit">{d.title}</a></div>
28
+ {d.role && <div class="g-persona__role">{d.role}</div>}
29
+ {d.bio && <p class="g-persona__bio">{d.bio}</p>}
30
+ <div class="g-persona__socials">
31
+ {d.website && <a href={d.website} aria-label={STRINGS.website} rel="noopener" target="_blank"><i class="fa-solid fa-globe" aria-hidden="true"></i></a>}
32
+ {d.social.map((s) => <a href={s.url} aria-label={s.label} rel="noopener" target="_blank"><i class={s.icon} aria-hidden="true"></i></a>)}
33
+ </div>
34
+ </div>
35
+ </>
36
+ )}
37
+ {guest && (
38
+ <>
39
+ {guest.photo && <img class="g-persona__img" src={guest.photo} alt={guest.name} />}
40
+ <div>
41
+ <div class="g-persona__name">{guest.name} <span class="g-badge g-badge--soft" style="vertical-align:middle">{STRINGS.guest}</span></div>
42
+ {guest.title && <div class="g-persona__role">{guest.title}</div>}
43
+ {guest.bio && <p class="g-persona__bio">{guest.bio}</p>}
44
+ <div class="g-persona__socials">
45
+ {guest.website && <a href={guest.website} aria-label={STRINGS.website} rel="noopener" target="_blank"><i class="fa-solid fa-globe" aria-hidden="true"></i></a>}
46
+ {(guest.social ?? []).map((s) => <a href={s.url} aria-label={s.label} rel="noopener" target="_blank"><i class={s.icon} aria-hidden="true"></i></a>)}
47
+ </div>
48
+ </div>
49
+ </>
50
+ )}
51
+ </div>
@@ -0,0 +1,22 @@
1
+ ---
2
+ /** Callout: use inside MDX: <Callout tone="tip" title="Two-deep rule">…</Callout>
3
+ * tone: info | tip | warn (mirrors the Hugo `callout` shortcode). */
4
+ interface Props {
5
+ tone?: 'info' | 'tip' | 'warn';
6
+ title?: string;
7
+ }
8
+ const { tone = 'info', title } = Astro.props;
9
+ const icons = {
10
+ info: 'fa-solid fa-circle-info',
11
+ tip: 'fa-solid fa-lightbulb',
12
+ warn: 'fa-solid fa-triangle-exclamation',
13
+ };
14
+ ---
15
+
16
+ <div class={`g-callout${tone !== 'info' ? ` g-callout--${tone}` : ''}`}>
17
+ <i class={icons[tone]} aria-hidden="true"></i>
18
+ <div class="g-callout__body">
19
+ {title && <div class="g-callout__title">{title}</div>}
20
+ <slot />
21
+ </div>
22
+ </div>
@@ -0,0 +1,29 @@
1
+ ---
2
+ import { STRINGS } from 'popular:config';
3
+ /** Checklist: use inside MDX:
4
+ * <Checklist id="rb-venue" items={[ 'Shortlist venues', 'Confirm access' ]} />
5
+ * `id` must be unique across the site, it namespaces the saved progress
6
+ * (localStorage, same key format as the Hugo theme: popular-check:<id>). */
7
+ interface Props {
8
+ id: string;
9
+ items: string[];
10
+ }
11
+ const { id, items } = Astro.props;
12
+ ---
13
+
14
+ <div class="g-checklist" data-key={id}>
15
+ <div class="g-checklist__head">
16
+ <span>{STRINGS.checklist}</span>
17
+ <span class="g-checklist__count">0/{items.length} {STRINGS.checklistDone}</span>
18
+ </div>
19
+ <ul>
20
+ {items.map((item) => (
21
+ <li>
22
+ <button class="g-check" type="button" role="checkbox" aria-checked="false">
23
+ <span class="g-check__box"></span>
24
+ <span class="g-check__label">{item}</span>
25
+ </button>
26
+ </li>
27
+ ))}
28
+ </ul>
29
+ </div>
@@ -0,0 +1,50 @@
1
+ ---
2
+ /** DemoBar: fixed demo switcher, rendered ONLY when the config exports a
3
+ * non-null DEMO_BAR (the theme's own demo builds). Adopters: set
4
+ * `export const DEMO_BAR = null;` (or remove demo content) and it disappears.
5
+ * Links are computed client-side by swapping the /<slug>/ path segment. */
6
+ import * as cfg from 'popular:config';
7
+ const bar = import.meta.env.DEV ? null : ((cfg as Record<string, any>).DEMO_BAR ?? null);
8
+ ---
9
+
10
+ {bar && (
11
+ <>
12
+ <style>
13
+ .g-demobar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 90;
14
+ display: flex; align-items: center; gap: 2px; padding: 5px;
15
+ background: color-mix(in srgb, var(--ink-900) 92%, transparent); color: var(--ink-200);
16
+ border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); font-size: var(--text-xs);
17
+ font-family: var(--font-sans); backdrop-filter: blur(8px); }
18
+ .g-demobar__label { padding: 0 8px 0 12px; color: var(--ink-400); font-weight: var(--weight-semibold);
19
+ letter-spacing: var(--tracking-wide); text-transform: uppercase; font-size: 0.65rem; }
20
+ .g-demobar a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
21
+ border-radius: var(--radius-pill); color: var(--ink-300); text-decoration: none; white-space: nowrap; }
22
+ .g-demobar a:hover { color: #fff; background: rgba(255,255,255,0.08); }
23
+ .g-demobar a.is-current { background: var(--color-primary); color: #fff; }
24
+ @media (max-width: 640px) { .g-demobar__label { display: none; } }
25
+ </style>
26
+ <nav class="g-demobar" aria-label="Theme demos">
27
+ <a href="#" data-demo-home><i class="fa-solid fa-star" aria-hidden="true"></i>Popular</a>
28
+ <span class="g-demobar__label">Demo</span>
29
+ {bar.links.map((l: any) => (
30
+ <a href="#" data-demo={l.slug} class={l.slug === bar.current ? 'is-current' : ''}>
31
+ <i class={l.icon} aria-hidden="true"></i>{l.label}
32
+ </a>
33
+ ))}
34
+ {bar.repo && <a href={bar.repo} rel="noopener" target="_blank"><i class="fa-brands fa-github" aria-hidden="true"></i>Source</a>}
35
+ </nav>
36
+ <script is:inline define:vars={{ slugs: bar.links.map((l: any) => l.slug) }}>
37
+ (function () {
38
+ var path = window.location.pathname;
39
+ var re = new RegExp('/(' + slugs.join('|') + ')/');
40
+ var home = document.querySelector('.g-demobar a[data-demo-home]');
41
+ if (home) { var m = path.search(re); home.href = m >= 0 ? path.slice(0, m + 1) : '/'; }
42
+ document.querySelectorAll('.g-demobar a[data-demo]').forEach(function (a) {
43
+ var slug = a.getAttribute('data-demo');
44
+ if (re.test(path)) a.href = path.replace(re, '/' + slug + '/').replace(/\/[^/]*$/, '/');
45
+ else a.href = '/' + slug + '/';
46
+ });
47
+ })();
48
+ </script>
49
+ </>
50
+ )}