mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
feature: convert form input to Svelte component and create module for
fetching event data & parsing it
This commit is contained in:
45
lib/frontend/components/Input.svelte
Normal file
45
lib/frontend/components/Input.svelte
Normal file
@ -0,0 +1,45 @@
|
||||
<style>
|
||||
#form {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
#form input {
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { createEvent } from '../actions'
|
||||
import logger from '../../static/app/logger'
|
||||
|
||||
let value
|
||||
|
||||
const onChange = (e) => {
|
||||
value = e.currentTarget.value
|
||||
}
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
createEvent(value, { logger })
|
||||
}
|
||||
</script>
|
||||
|
||||
<form id="form">
|
||||
<input
|
||||
required
|
||||
pattern="^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?|\d+$"
|
||||
id="url"
|
||||
name="url"
|
||||
bind:value={value}
|
||||
placeholder="Paste / type FB event URL or event number..."
|
||||
title="Please insert Facebook Event URL / Number"
|
||||
/>
|
||||
<input
|
||||
id="submit"
|
||||
type='submit'
|
||||
value='Submit'
|
||||
on:click={handleSubmit}
|
||||
/>
|
||||
</form>
|
Reference in New Issue
Block a user