import {html} from 'htm/preact'; import {useContext} from 'preact/hooks'; import {AppContext, TRXComponent} from '../..'; export type SettingProps = { children: TRXComponent | undefined; class: string; enabled: boolean; feature: string; title: string; }; function Header(props: SettingProps): TRXComponent { const context = useContext(AppContext); const enabled = props.enabled ? 'Enabled' : 'Disabled'; return html`

${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): TRXComponent { const children = props.children === undefined ? html`

This setting still needs a component!

` : props.children; const enabled = (props.enabled ? 'Enabled' : 'Disabled').toLowerCase(); return html`
<${Header} ...${props} />
${children}
`; } export * from './about'; export * from './autocomplete'; export * from './back-to-top'; export * from './hide-votes'; export * from './jump-to-new-comment'; export * from './markdown-toolbar'; export * from './user-labels';