Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583646
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/components/components.ts b/src/components/components.ts
index 811d3d4..51cbc13 100644
--- a/src/components/components.ts
+++ b/src/components/components.ts
@@ -1 +1,2 @@
export * from "./tabs";
+export * from "./toggle-modal";
diff --git a/src/components/toggle-modal.ts b/src/components/toggle-modal.ts
new file mode 100644
index 0000000..c38c329
--- /dev/null
+++ b/src/components/toggle-modal.ts
@@ -0,0 +1,52 @@
+import { FlatTemplatable, tempstream } from "tempstream";
+import { makeSlug } from "../utils/utils";
+
+export function toggleModal(options: {
+ name: string;
+ contentWrapped: (id: string) => FlatTemplatable | Promise<FlatTemplatable>;
+ contentUnwrapped: (
+ id: string
+ ) => FlatTemplatable | Promise<FlatTemplatable>;
+}) {
+ const { contentWrapped, contentUnwrapped, name } = options;
+ const id = makeSlug(name);
+ return tempstream/* HTML */ `<style>
+ .toggle-modal__wrapped {
+ display: none;
+ }
+
+ @media (max-width: 960px) {
+ .toggle-modal__wrapped {
+ display: block;
+ }
+ .toggle-modal__unwrapped {
+ display: none;
+ }
+
+ #${id} {
+ display: none;
+ }
+
+ #${id}:checked ~ .toggle-modal__wrapped {
+ display: none;
+ }
+
+ #${id}:checked ~ .toggle-modal__unwrapped {
+ display: block;
+ position: fixed;
+ height: 100vh;
+ width: 100vw;
+ top: 0;
+ left: 0;
+ background-color: white;
+ z-index: 99;
+ overflow-y: scroll;
+ }
+ }
+ </style>
+ <div class="toggle-modal toggle-modal--${id}">
+ <input id="${id}" name="${id}" type="checkbox" autocomplete="off" />
+ <div class="toggle-modal__wrapped">${contentWrapped(id)}</div>
+ <div class="toggle-modal__unwrapped">${contentUnwrapped(id)}</div>
+ </div>`;
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 11, 10:20 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984204
Default Alt Text
(1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment