redux-devtools/extension/src/options/AllowToRunGroup.tsx
Nathan Bierema 6cc517d97e
Refactor extension directory structure (#1248)
* Move background to top-level

* Move devpanel to top-level

* Move devtools to top-level

* Move options to top-level

* Move window to top-level

* Move chromeApiMock to top-level

* Move manifests to top-level

* Move contentScript to top-level

* Move pageScript to top-level

* Update tests

* Update Webpack config

* Fix path
2022-10-10 13:05:28 -04:00

54 lines
1.6 KiB
TypeScript

import React from 'react';
import { OptionsProps } from './Options';
export default ({ options, saveOption }: OptionsProps) => {
const AllowToRunState = {
EVERYWHERE: true,
ON_SPECIFIC_URLS: false,
};
return (
<fieldset className="option-group">
<legend className="option-group__title">Allow to run</legend>
<div className="option option_type_radio">
<input
className="option__element"
id="inject-always"
name="inject"
type="radio"
checked={options.inject === AllowToRunState.EVERYWHERE}
onChange={() => saveOption('inject', AllowToRunState.EVERYWHERE)}
/>
<label className="option__label" htmlFor="inject-always">
Everywhere
</label>
</div>
<div className="option option_type_radio">
<input
className="option__element"
id="inject-specific"
name="inject"
type="radio"
checked={options.inject === AllowToRunState.ON_SPECIFIC_URLS}
onChange={() =>
saveOption('inject', AllowToRunState.ON_SPECIFIC_URLS)
}
/>
<label className="option__label" htmlFor="inject-specific">
Only on the following URLs:
</label>
<br />
<textarea
className="option__textarea"
value={options.urls}
disabled={options.inject !== AllowToRunState.ON_SPECIFIC_URLS}
onChange={(e) => saveOption('urls', e.target.value)}
/>
<div className="option__hint">Each RegExp from the new line</div>
</div>
</fieldset>
);
};