import {Component, type ComponentChildren, type JSX} from "preact"; // eslint-disable-next-line n/file-extension-in-import import {useContext} from "preact/hooks"; import {AppContext} from "../context.js"; import {type Feature} from "../../storage/exports.js"; export type SettingProps = { children: ComponentChildren; class: string; enabled: boolean; feature: Feature; title: string; }; class Header extends Component { render() { const {props} = this; const context = useContext(AppContext); const enabled = props.enabled ? "Enabled" : "Disabled"; return (

{props.title}

); } } // A base component for all the settings, this adds the header and the // enable/disable buttons. This can also be used as a placeholder for new // settings when you're still developing them. export function Setting(props: SettingProps): JSX.Element { const children = props.children ?? (

This setting still needs a component!

); const enabled = (props.enabled ? "Enabled" : "Disabled").toLowerCase(); return (
{children}
); }