mess around

This commit is contained in:
2024-01-04 00:20:20 +01:00
parent febab6e561
commit 09a943bc6c
10 changed files with 750 additions and 262 deletions

View File

@@ -1,73 +1,74 @@
<script>
import { page } from '$app/stores';
import { tagList } from '$lib/stores.js';
import { page } from '$app/stores';
import { tagList } from '$lib/stores.js';
export let original;
let tagMap = new Map();
export let original;
let tagMap = new Map();
// Create a mapping of tags and their checked status
let reloadTags = (original) => {
tagList.forEach((tag) => {
tagMap.set(tag, original.tags.includes(tag));
});
};
// Create a mapping of tags and their checked status
let reloadTags = (original) => {
tagList.forEach((tag) => {
tagMap.set(tag, original.tags.includes(tag));
});
};
$: reloadTags(original);
$: reloadTags(original);
</script>
{#key $page.url.pathname}
<form method="POST">
<br />
<label>
<p>Title:</p>
<input type="text" name="title" bind:value={original.title} />
</label>
<br />
<form method="POST">
<br />
<label>
<p>Title:</p>
<input type="text" name="title" bind:value={original.title} />
</label>
<br />
<label>
<p>Description:</p>
<textarea
style="min-width:400px;min-height:100px"
name="description"
bind:value={original.description}
/>
</label>
<br />
<label>
<p>Tags:</p>
<div class="checkboxContainer">
{#each tagList as tag}
<label>
<input type="checkbox" name="tags" value={tag} checked={tagMap.get(tag)} />
{tag}
</label>
{/each}
</div>
</label>
<br />
<label>
<p>Description:</p>
<textarea
style="min-width:400px;min-height:100px"
name="description"
bind:value={original.description}
/>
</label>
<br />
<label>
<p>Tags:</p>
<div class="checkboxContainer">
{#each tagList as tag}
<label>
<input type="checkbox" name="tags" value={tag} checked={tagMap.get(tag)} />
{tag}
</label>
{/each}
</div>
</label>
<br />
<button type="submit">Submit</button>
</form>
<button type="submit">Submit</button>
</form>
{/key}
<style>
form {
margin-left: 10px;
}
form {
margin-left: 10px;
text-align: left;
}
label {
display: flex;
align-items: center;
}
label {
display: flex;
align-items: center;
}
label > p {
margin-right: 5px;
}
label > p {
margin-right: 5px;
}
.checkboxContainer {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 1px;
max-width: 50%;
}
.checkboxContainer {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 1px;
max-width: 50%;
}
</style>