1
Fork 0

Fix toggling settings.

Explanation: https://github.com/preactjs/preact/issues/3044
This commit is contained in:
Bauke 2021-02-25 15:20:35 +01:00
parent 18dd962767
commit 58b5192d5a
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 3 additions and 7 deletions

View File

@ -3,7 +3,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Tildes ReExtended", "name": "Tildes ReExtended",
"description": "An updated and reimagined recreation of Tildes Extended to enhance and improve the experience of Tildes.net.", "description": "An updated and reimagined recreation of Tildes Extended to enhance and improve the experience of Tildes.net.",
"version": "1.0.2", "version": "1.0.3",
"permissions": [ "permissions": [
"downloads", "downloads",
"storage", "storage",

View File

@ -10,19 +10,15 @@ export type SettingProps = {
title: string; title: string;
}; };
function toggleFeature(feature: string) {
const {toggleFeature: toggle} = useContext(AppContext);
toggle(feature);
}
function Header(props: SettingProps): TRXComponent { function Header(props: SettingProps): TRXComponent {
const context = useContext(AppContext);
const enabled = props.enabled ? 'Enabled' : 'Disabled'; const enabled = props.enabled ? 'Enabled' : 'Disabled';
return html`<header> return html`<header>
<h2>${props.title}</h2> <h2>${props.title}</h2>
<button <button
onClick="${() => { onClick="${() => {
toggleFeature(props.feature); context.toggleFeature(props.feature);
}}" }}"
> >
${enabled} ${enabled}