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 / Import / FromFileUpload / components / SelectedFilesList.tsx

SelectedFilesList.tsx in Code Snippets 4.0.0-beta.1, at js/components/Import/FromFileUpload/components/SelectedFilesList.tsx

66 lines 1.7 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 { __ } from '@wordpress/i18n'
3 import { formatFileSize } from '../utils/fileUtils'
4
5 interface SelectedFilesListProps {
6 files: FileList
7 onRemoveFile: (index: number) => void
8 }
9
10 export const SelectedFilesList: React.FC<SelectedFilesListProps> = ({
11 files,
12 onRemoveFile
13 }) => {
14 return (
15 <div className="selected-files" style={{ marginBottom: '20px' }}>
16 <h3 style={{ margin: '0 0 12px 0', fontSize: '14px', fontWeight: '600' }}>
17 {__('Selected Files:', 'code-snippets')} ({files.length})
18 </h3>
19 <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
20 {Array.from(files).map((file, index) => (
21 <div
22 key={index}
23 style={{
24 display: 'flex',
25 alignItems: 'center',
26 justifyContent: 'space-between',
27 padding: '8px 12px',
28 backgroundColor: '#f9f9f9',
29 borderRadius: '4px',
30 border: '1px solid #ddd'
31 }}
32 >
33 <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
34 <span style={{ fontSize: '16px' }}>📄</span>
35 <div>
36 <div style={{ fontWeight: '500' }}>{file.name}</div>
37 <div style={{ fontSize: '12px', color: '#666' }}>
38 {formatFileSize(file.size)}
39 </div>
40 </div>
41 </div>
42 <button
43 type="button"
44 onClick={(e) => {
45 e.stopPropagation()
46 onRemoveFile(index)
47 }}
48 style={{
49 background: 'none',
50 border: 'none',
51 color: '#d63638',
52 cursor: 'pointer',
53 fontSize: '16px',
54 padding: '4px'
55 }}
56 title={__('Remove file', 'code-snippets')}
57 >
58 ✕
59 </button>
60 </div>
61 ))}
62 </div>
63 </div>
64 )
65 }
66