Fix toggling settings.
Explanation: https://github.com/preactjs/preact/issues/3044
This commit is contained in:
parent
18dd962767
commit
58b5192d5a
|
@ -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",
|
||||||
|
|
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue