feat: add image zoom options (#984)

This commit is contained in:
Aman Harwara
2022-04-19 14:00:23 +05:30
committed by GitHub
parent b6eeaea516
commit a78c0ce2a1
13 changed files with 108 additions and 26 deletions

View File

@@ -0,0 +1,24 @@
import { SNFile } from '@standardnotes/snjs'
import { FunctionComponent } from 'preact'
import { ImagePreview } from './ImagePreview'
type Props = {
file: SNFile
objectUrl: string
}
export const PreviewComponent: FunctionComponent<Props> = ({ file, objectUrl }) => {
if (file.mimeType.startsWith('image/')) {
return <ImagePreview objectUrl={objectUrl} />
}
if (file.mimeType.startsWith('video/')) {
return <video className="w-full h-full" src={objectUrl} controls />
}
if (file.mimeType.startsWith('audio/')) {
return <audio src={objectUrl} controls />
}
return <object className="w-full h-full" data={objectUrl} />
}