import { FlatTemplatable, tempstream } from "tempstream";
function name_to_id(str: string) {
return str.replace(/\W/g, "-");
}
const style = (hide_tabs_width: number) =>
/* HTML */ ``;
export function tabs(
tabs: Record,
selected_tab_style = "font-weight: bold;",
selected_index = 0,
hide_tabs_width = 0
): FlatTemplatable {
return /* HTML */ tempstream`${style(hide_tabs_width)}
${Object.keys(tabs)
.map((tab_title, index) => {
const id = name_to_id(tab_title);
return /* HTML */ `
`;
})
.join("\n")}
${Object.entries(tabs).map(([title, content]) => {
const id = name_to_id(title);
return /* HTML */ tempstream`
${title}
${content}
`;
})}`;
}