| 1 |
import React from 'react' |
| 2 |
import { __ } from '@wordpress/i18n' |
| 3 |
import { ImportCard } from '../common/ImportCard' |
| 4 |
import { useMigrationOptions } from './WithMigrationOptions' |
| 5 |
|
| 6 |
export const ImportOptions: React.FC = () => { |
| 7 |
const { autoAddTags, setAutoAddTags, tagValue, setTagValue } = useMigrationOptions() |
| 8 |
|
| 9 |
return ( |
| 10 |
<ImportCard className="import-options-card"> |
| 11 |
<h3>{__('Import options', 'code-snippets')}</h3> |
| 12 |
<label> |
| 13 |
<input |
| 14 |
type="checkbox" |
| 15 |
checked={autoAddTags} |
| 16 |
onChange={event => setAutoAddTags(event.target.checked)} |
| 17 |
aria-labelledby="code-snippets-import-auto-add-tags-label" |
| 18 |
/> |
| 19 |
<div> |
| 20 |
<div> |
| 21 |
<strong id="code-snippets-import-auto-add-tags-label"> |
| 22 |
{__('Add tag automatically', 'code-snippets')} |
| 23 |
</strong> |
| 24 |
<br /> |
| 25 |
<span className="description"> |
| 26 |
{__('For your convenience, we can add a tag on every imported snippet.', 'code-snippets')} |
| 27 |
</span> |
| 28 |
</div> |
| 29 |
{autoAddTags && ( |
| 30 |
<div className="import-tag-entry"> |
| 31 |
<input |
| 32 |
id="import-auto-tag" |
| 33 |
type="text" |
| 34 |
value={tagValue} |
| 35 |
onChange={event => setTagValue(event.target.value)} |
| 36 |
placeholder={__('Add tag…', 'code-snippets')} |
| 37 |
aria-label={__('Tag to add to imported snippets', 'code-snippets')} |
| 38 |
className="regular-text" |
| 39 |
/> |
| 40 |
</div>)} |
| 41 |
</div> |
| 42 |
</label> |
| 43 |
</ImportCard> |
| 44 |
) |
| 45 |
} |
| 46 |
|