-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ placeholder add contact form
- Loading branch information
1 parent
748c5b0
commit 97771f1
Showing
5 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import type { HTMLInputTypeAttribute } from "svelte/elements"; | ||
export let label: string; | ||
export let id: string | undefined = undefined; | ||
export let name: string; | ||
export let type: HTMLInputTypeAttribute | undefined = undefined; | ||
export let placeholder: string | undefined = undefined; | ||
</script> | ||
|
||
<label> | ||
<span>{label}</span> | ||
<input {id} {name} {type} {placeholder} /> | ||
</label> | ||
|
||
<style lang="scss"> | ||
label { | ||
display: block; | ||
font-size: 14px; | ||
margin: var(--input-margin, 0); | ||
span { | ||
display: block; | ||
margin-bottom: 12px; | ||
} | ||
} | ||
input { | ||
all: unset; | ||
font-size: 16px; | ||
border-radius: 6px; | ||
border: 1px solid var(--gray200); | ||
padding: 8px 12px; | ||
transition: border 250ms cubic-bezier(0.76, 0, 0.24, 1); | ||
box-sizing: border-box; | ||
cursor: text; | ||
width: 100%; | ||
// TODO: Check browser compatibility | ||
&:hover:not(:disabled) { | ||
border: 1px solid var(--gray300); | ||
} | ||
&:disabled { | ||
cursor: not-allowed; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
import AddContact from "./AddContact.svelte"; | ||
import BulkAddContact from "./BulkAddContact.svelte"; | ||
</script> | ||
|
||
<div class="actions"> | ||
<BulkAddContact /> | ||
<AddContact /> | ||
</div> | ||
|
||
<style lang="scss"> | ||
.actions { | ||
display: flex; | ||
justify-content: flex-end; | ||
margin: 12px 16px; | ||
gap: 12px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { PlusCircle } from "lucide-svelte"; | ||
import type { EventHandler } from "svelte/elements"; | ||
import Dialog from "$lib/components/Dialog.svelte"; | ||
import LabelInput from "$lib/components/LabelInput.svelte"; | ||
const addContact: EventHandler<SubmitEvent, HTMLFormElement> = (e) => { | ||
const formData = new FormData(e.currentTarget); | ||
console.log(Object.fromEntries(formData.entries())); | ||
}; | ||
</script> | ||
|
||
<Dialog title="Add Contact"> | ||
<button let:trigger use:melt={trigger} slot="trigger"> | ||
<PlusCircle size={14} /><span>Add Contact</span> | ||
</button> | ||
|
||
<form on:submit|preventDefault={addContact} id="add-contact"> | ||
<LabelInput label="Company" name="company" placeholder="Company" /> | ||
<LabelInput label="Contact Name" name="contact-name" placeholder="Contact Name" /> | ||
<LabelInput label="Contact Email" name="contact-email" placeholder="Contact Email" /> | ||
<LabelInput label="Title" name="title" placeholder="Title" /> | ||
<LabelInput label="Status" name="status" placeholder="Status" /> | ||
<LabelInput label="Committee Member" name="committee-member" placeholder="Committee Member" /> | ||
<LabelInput | ||
label="Last Contact Date" | ||
name="last-contact-date" | ||
placeholder="Last Contact Date" | ||
/> | ||
<LabelInput label="Followup Date" name="followup-date" placeholder="Followup Date" /> | ||
<LabelInput label="Notes" name="notes" placeholder="Notes" /> | ||
</form> | ||
|
||
<button slot="bottom" class="action" form="add-contact"> | ||
<PlusCircle size={14} /><span>Add Contact</span> | ||
</button> | ||
</Dialog> | ||
|
||
<style lang="scss"> | ||
@use "$lib/styles/button" as button; | ||
button { | ||
@include button.button; | ||
} | ||
form { | ||
--input-margin: 0 0 16px 0; | ||
padding: 24px 16px; | ||
} | ||
.action { | ||
margin-left: auto; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
import { PlusCircle } from "lucide-svelte"; | ||
</script> | ||
|
||
<button disabled> | ||
<PlusCircle size={14} /><span>Bulk Add Member</span> | ||
</button> | ||
|
||
<style lang="scss"> | ||
@use "$lib/styles/button" as button; | ||
button { | ||
@include button.button; | ||
} | ||
</style> |