feat: Add activity types functionality to CreateNewAdventure and AdventureCard components

This commit is contained in:
Sean Morley
2024-05-04 00:43:18 +00:00
parent eab7cb6087
commit 3127784632
4 changed files with 38 additions and 17 deletions

View File

@@ -40,9 +40,8 @@
if (activityInput.trim() !== "") {
const activities = activityInput
.split(",")
.map((activity) => activity.trim());
.filter((activity) => activity.trim() !== "");
adventureToEdit.activityTypes = activities;
// override the original activity types
activityInput = "";
}
console.log(adventureToEdit.activityTypes);
@@ -97,7 +96,7 @@
/>
</div>
<div>
<label for="date">Activity Types</label>
<label for="date">Activity Types (Comma Seperated)</label>
<input
type="text"
id="activityTypes"
@@ -105,6 +104,17 @@
class="input input-bordered w-full max-w-xs"
/>
</div>
<div>
<label for="rating">Rating</label>
<input
type="number"
min="0"
max="5"
id="rating"
bind:value={adventureToEdit.rating}
class="input input-bordered w-full max-w-xs"
/>
</div>
<button class="btn btn-primary mr-4 mt-4" on:click={submit}>Save</button
>
<!-- if there is a button in form, it will close the modal -->