← All changes
|
js/components/EditMenu/EditorSidebar/actions/ExportButtons.tsx
+9
-3
3.10.2
→
4.0.0-beta.2
View file →
| @@ -10,12 +10,14 @@ | ||
| 10 | 10 | |
| 11 | 11 | interface ExportButtonProps { |
| 12 | 12 | name: string |
| 13 | 13 | label: string |
| 14 | + icon: string | |
| 15 | + title?: string | |
| 14 | 16 | makeRequest: (snippet: Snippet) => Promise<SnippetsExport | string> |
| 15 | 17 | } |
| 16 | 18 | |
| 17 | -const ExportButton: React.FC<ExportButtonProps> = ({ name, label, makeRequest }) => { | |
| 19 | +const ExportButton: React.FC<ExportButtonProps> = ({ name, label, icon, title, makeRequest }) => { | |
| 18 | 20 | const { snippet, isWorking, setIsWorking, handleRequestError } = useSnippetForm() |
| 19 | 21 | |
| 20 | 22 | const handleClick = () => { |
| 21 | 23 | setIsWorking(true) |
| @@ -27,9 +29,10 @@ | ||
| 27 | 29 | .finally(() => setIsWorking(false)) |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | return ( |
| 31 | - <Button name={name} onClick={handleClick} disabled={isWorking}> | |
| 33 | + <Button name={name} onClick={handleClick} disabled={isWorking} title={title}> | |
| 34 | + <span className={`dashicons ${icon}`} aria-hidden="true" /> | |
| 32 | 35 | {label} |
| 33 | 36 | </Button> |
| 34 | 37 | ) |
| 35 | 38 | } |
| @@ -42,8 +45,10 @@ | ||
| 42 | 45 | <div className="snippet-export-buttons"> |
| 43 | 46 | <ExportButton |
| 44 | 47 | name="export_snippet" |
| 45 | 48 | label={__('Export', 'code-snippets')} |
| 49 | + icon="dashicons-upload" | |
| 50 | + title={__('Download snippet as JSON', 'code-snippets')} | |
| 46 | 51 | makeRequest={api.export} |
| 47 | 52 | /> |
| 48 | 53 | |
| 49 | 54 | {window.CODE_SNIPPETS_EDIT?.enableDownloads && 'cond' !== getSnippetType(snippet) && ( |
| @@ -48,9 +53,10 @@ | ||
| 48 | 53 | |
| 49 | 54 | {window.CODE_SNIPPETS_EDIT?.enableDownloads && 'cond' !== getSnippetType(snippet) && ( |
| 50 | 55 | <ExportButton |
| 51 | 56 | name="export_snippet_code" |
| 52 | - label={__('Download Code', 'code-snippets')} | |
| 57 | + label={__('Download', 'code-snippets')} | |
| 58 | + icon="dashicons-download" | |
| 53 | 59 | makeRequest={api.exportCode} |
| 54 | 60 | />)} |
| 55 | 61 | </div> |
| 56 | 62 | ) |