feat(create): add Image and File items
This commit is contained in:
parent
c391b01b90
commit
889d6a0f44
19
src/components/DrawPDFFields/internal/FileItem.tsx
Normal file
19
src/components/DrawPDFFields/internal/FileItem.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { SigitFile } from '../../../utils/file'
|
||||||
|
import { ExtensionFileBox } from '../../ExtensionFileBox'
|
||||||
|
import { ImageItem } from './ImageItem'
|
||||||
|
|
||||||
|
interface FileItemProps {
|
||||||
|
file: SigitFile
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FileItem = React.memo(({ file }: FileItemProps) => {
|
||||||
|
const content = <ExtensionFileBox extension={file.extension} />
|
||||||
|
if (file.isImage) return <ImageItem file={file} />
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={file.name} className="file-wrapper" id={`file-${file.name}`}>
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
10
src/components/DrawPDFFields/internal/ImageItem.tsx
Normal file
10
src/components/DrawPDFFields/internal/ImageItem.tsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { SigitFile } from '../../../utils/file'
|
||||||
|
|
||||||
|
interface ImageItemProps {
|
||||||
|
file: SigitFile
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ImageItem = React.memo(({ file }: ImageItemProps) => {
|
||||||
|
return <img className="file-image" src={file.objectUrl} alt={file.name} />
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user