sanifae/src/routes/new_post/+page.svelte

45 lines
1.1 KiB
Svelte
Raw Normal View History

2023-01-30 16:17:58 -05:00
<script>
2023-02-05 09:47:26 -05:00
import Area from '$lib/components/Area.svelte';
2023-01-30 16:17:58 -05:00
2023-02-03 21:54:01 -05:00
import { handleSubmit } from '$lib/util.js';
2023-01-30 16:17:58 -05:00
/** @type {import('./$types').ActionData} */
export let form;
</script>
<style>
textarea {
width: 10rem;
height: 10rem;
}
</style>
<Area>
<p slot="header">
Create Post
</p>
2023-02-03 21:54:01 -05:00
<form slot="main" action='/api/postCreate' method='POST' on:submit|preventDefault={async e => form = JSON.parse(await handleSubmit(e)) }>
2023-01-30 16:17:58 -05:00
<p>
<textarea name='content'></textarea>
</p>
<p>
<input formaction="?/create" type='submit' value='Post'>
</p>
</form>
2023-02-07 19:36:32 -05:00
<span slot="footer">
<p>
{#if form?.success}
{#if form?.href}
<a href='{form?.href}'>{form?.success}</a>
{:else}
{form?.success}
{/if}
{/if}
</p>
<p>Create a post for the world to see.</p>
<h2>Post syntax</h2>
<p>
<b>img||filename.blah</b> embeds a user-uploaded file in this site
</p>
</span>
2023-01-30 16:17:58 -05:00
</Area>