PluginProbe
Code Snippets / 4.0.0-beta.1
Code Snippets v4.0.0-beta.1
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / js / components / ImportMenu / MigrateForm / ImporterSelector.tsx

ImporterSelector.tsx in Code Snippets 4.0.0-beta.1, at js/components/ImportMenu/MigrateForm/ImporterSelector.tsx

44 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react'
2 import { __, sprintf } from '@wordpress/i18n'
3 import { ImportCard } from '../common/ImportCard'
4 import type { Importer } from './WithMigrationData'
5
6 export interface ImporterSelectorProps {
7 value: string
8 onChange: (newValue: string) => void
9 isLoading: boolean
10 options: Importer[]
11 }
12
13 export const ImporterSelector: React.FC<ImporterSelectorProps> = ({ value, onChange, options, isLoading }) =>
14 <ImportCard variant="controls" className="importer-selector-card">
15 <h3 id="importer-select-heading">{__('Select plugin', 'code-snippets')}</h3>
16 <label htmlFor="importer-select" className="screen-reader-text">
17 {__('Select plugin to migrate from', 'code-snippets')}
18 </label>
19
20 <select
21 aria-labelledby="importer-select-heading"
22 id="importer-select"
23 value={value}
24 onChange={event => onChange(event.target.value)}
25 className="regular-text"
26 disabled={isLoading}
27 >
28 <option value="">{__('-- Select an importer --', 'code-snippets')}</option>
29 {options.map(importer =>
30 <option
31 key={importer.name}
32 value={importer.name}
33 disabled={!importer.is_active}
34 >
35 {importer.is_active
36 ? importer.title
37 // translators: %s: importer title.
38 : sprintf(__('%s (Inactive)', 'code-snippets'), importer.title)}
39 </option>)}
40 </select>
41
42 {isLoading && <p role="status" aria-live="polite">{__('Loading snippets…', 'code-snippets')}</p>}
43 </ImportCard>
44