PluginProbe
Code Snippets / 3.6.6
Code Snippets v3.6.6
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 3.0.1 All 64 releases
code-snippets / js / components / SnippetForm / fields / PriorityInput.tsx

PriorityInput.tsx in Code Snippets 3.6.6, at js/components/SnippetForm/fields/PriorityInput.tsx

28 lines 864 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react'
2 import { __ } from '@wordpress/i18n'
3 import { getSnippetType } from '../../../utils/snippets'
4 import { useSnippetForm } from '../../../hooks/useSnippetForm'
5
6 export const PriorityInput: React.FC = () => {
7 const { snippet, setSnippet, isReadOnly } = useSnippetForm()
8
9 return 'html' === getSnippetType(snippet) ? null :
10 <p
11 className="snippet-priority"
12 title={__('Snippets with a lower priority number will run before those with a higher number.', 'code-snippets')}
13 >
14 <label htmlFor="snippet_priority">{`${__('Priority', 'code-snippets')} `}</label>
15 <input
16 type="number"
17 id="snippet_priority"
18 name="snippet_priority"
19 value={snippet.priority}
20 disabled={isReadOnly}
21 onChange={event => setSnippet(previous => ({
22 ...previous,
23 priority: parseInt(event.target.value, 10)
24 }))}
25 />
26 </p>
27 }
28