mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 09:27:23 +00:00
Unified file link format
This commit is contained in:
parent
1e1e611104
commit
19e051045d
5 changed files with 96 additions and 13 deletions
15
src/components/FileSelector.js
Normal file
15
src/components/FileSelector.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ emitName, emitURL }) {
|
||||
const fileInputHandler = ({ target }) => {
|
||||
const file = target.files[0]
|
||||
emitName(file.name)
|
||||
emitURL(URL.createObjectURL(file))
|
||||
target.value = null
|
||||
}
|
||||
|
||||
return (
|
||||
<input
|
||||
type='file'
|
||||
onChange={fileInputHandler} />)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue