Rearrange components

This commit is contained in:
He4eT 2021-03-02 16:48:24 +05:00
commit 90f630f277
13 changed files with 10 additions and 8 deletions

View file

@ -1,23 +0,0 @@
import { h } from 'preact'
export default function ({ setTargetName, setTargetUrl }) {
const urlRE = /^(http|https):\/\/[^ "]+$/
const emit = url => {
setTargetName(url)
setTargetUrl(url)
}
const urlInputHandler = ({ target }) => {
const url = target.value
emit(urlRE.test(url)
? url
: null)
}
return (
<input
type='text'
placeholder='https://...'
onInput={urlInputHandler} />)
}