diff --git a/add-on/src/options/forms/api-form.js b/add-on/src/options/forms/api-form.js index 17b0e194b..780ad2862 100644 --- a/add-on/src/options/forms/api-form.js +++ b/add-on/src/options/forms/api-form.js @@ -4,6 +4,7 @@ const browser = require('webextension-polyfill') const html = require('choo/html') const { normalizeGatewayURL } = require('../../lib/options') +const switchToggle = require('../../pages/components/switch-toggle') function apiForm ({ ipfsApiUrl, ipfsApiPollMs, automaticMode, onOptionChange }) { const onIpfsApiUrlChange = onOptionChange('ipfsApiUrl', normalizeGatewayURL) @@ -57,11 +58,7 @@ function apiForm ({ ipfsApiUrl, ipfsApiPollMs, automaticMode, onOptionChange })
${browser.i18n.getMessage('option_automaticMode_description')}
- +
${switchToggle({ id: 'automaticMode', checked: automaticMode, onchange: onAutomaticModeChange })}
diff --git a/add-on/src/options/forms/experiments-form.js b/add-on/src/options/forms/experiments-form.js index 51b3fffdd..4bb3d012d 100644 --- a/add-on/src/options/forms/experiments-form.js +++ b/add-on/src/options/forms/experiments-form.js @@ -3,6 +3,7 @@ const browser = require('webextension-polyfill') const html = require('choo/html') +const switchToggle = require('../../pages/components/switch-toggle') function experimentsForm ({ displayNotifications, @@ -35,7 +36,7 @@ function experimentsForm ({
${browser.i18n.getMessage('option_displayNotifications_description')}
- +
${switchToggle({ id: 'displayNotifications', checked: displayNotifications, onchange: onDisplayNotificationsChange })}
- +
${switchToggle({ id: 'preloadAtPublicGateway', checked: preloadAtPublicGateway, onchange: onPreloadAtPublicGatewayChange })}
- +
${switchToggle({ id: 'catchUnhandledProtocols', checked: catchUnhandledProtocols, onchange: onCatchUnhandledProtocolsChange })}
- +
${switchToggle({ id: 'linkify', checked: linkify, onchange: onLinkifyChange })}
- +
${switchToggle({ id: 'detectIpfsPathHeader', checked: detectIpfsPathHeader, onchange: onDetectIpfsPathHeaderChange })}
-
- +
diff --git a/add-on/src/options/forms/gateways-form.js b/add-on/src/options/forms/gateways-form.js index df993b9cd..b16f0e763 100644 --- a/add-on/src/options/forms/gateways-form.js +++ b/add-on/src/options/forms/gateways-form.js @@ -3,6 +3,7 @@ const browser = require('webextension-polyfill') const html = require('choo/html') +const switchToggle = require('../../pages/components/switch-toggle') const { normalizeGatewayURL, hostTextToArray, hostArrayToText } = require('../../lib/options') // Warn about mixed content issues when changing the gateway @@ -77,11 +78,7 @@ function gatewaysForm ({
${browser.i18n.getMessage('option_useCustomGateway_description')}
- +
${switchToggle({ id: 'useCustomGateway', checked: useCustomGateway, onchange: onUseCustomGatewayChange })}
` : null} ${supportRedirectToCustomGateway ? html` @@ -96,7 +93,7 @@ function gatewaysForm ({ id="noRedirectHostnames" spellcheck="false" onchange=${onNoRedirectHostnamesChange} - rows="4" + rows="4" >${hostArrayToText(noRedirectHostnames)} ` : null} diff --git a/add-on/src/options/forms/global-toggle-form.js b/add-on/src/options/forms/global-toggle-form.js index f1f9d1487..68c7bffde 100644 --- a/add-on/src/options/forms/global-toggle-form.js +++ b/add-on/src/options/forms/global-toggle-form.js @@ -3,13 +3,14 @@ const browser = require('webextension-polyfill') const html = require('choo/html') +const switchToggle = require('../../pages/components/switch-toggle') function globalToggleForm ({ active, onOptionChange }) { - const toggle = onOptionChange('active', checked => !checked) + const toggle = onOptionChange('active') return html`
-