Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10361403
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/back/routes/common/tabs/tabs.tsx b/src/back/routes/common/tabs/tabs.tsx
index 96a707b..57eebb6 100644
--- a/src/back/routes/common/tabs/tabs.tsx
+++ b/src/back/routes/common/tabs/tabs.tsx
@@ -1,73 +1,77 @@
import type { FlatTemplatable } from "tempstream";
import { TempstreamJSX } from "tempstream";
const ids = (function* () {
let i = 0;
while (true) {
yield i++;
if (i >= 100000) {
i = 0;
}
}
})();
export function tabs({
tabs,
default_tab,
tab_bar,
remember_tab = false,
active_navbar_tab_style = "",
}: {
- tabs: { id: string; label?: string; content: FlatTemplatable }[];
+ tabs: {
+ id: string;
+ label?: string;
+ content: FlatTemplatable | Promise<FlatTemplatable>;
+ }[];
default_tab: string;
tab_bar?: FlatTemplatable;
remember_tab?: boolean;
active_navbar_tab_style?: string;
}) {
const tab_section_id = ids.next().value;
return (
<section class={`tabs tabs__${tab_section_id}`}>
{tab_bar || (
<nav>
{tabs.map(({ id, label }) => (
<div class="tabs__tab-label">
<label>
<input
type="radio"
id={`tabs__${tab_section_id}__tab__${id}`}
name={`tabs__${tab_section_id}`}
checked={id == default_tab}
autocomplete={remember_tab ? false : "off"}
/>
{label || id}
{
/* HTML */ `<style>
.tabs__${tab_section_id} nav label:has(input:checked) {
${active_navbar_tab_style}
}
</style>`
}
</label>
</div>
))}
</nav>
)}
{tabs.map(({ id, content }) => {
const tab_id = `tabs__${tab_section_id}__tab__${id}`;
return (
<div class={`tabs__tab tabs__${tab_section_id}__tab ` + tab_id}>
{
/* HTML */ `<style>
body:has(#tabs__${tab_section_id}__tab__${id}:checked)
.${tab_id} {
display: block;
}
</style>`
}
{content}
</div>
);
})}
</section>
);
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 13:24 (9 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034621
Default Alt Text
(1 KB)
Attached To
Mode
rREWRITE Configurable rewriter
Attached
Detach File
Event Timeline
Log In to Comment