Skip to content

Commit

Permalink
create a form which allows users to share their existing list
Browse files Browse the repository at this point in the history
  • Loading branch information
stacy-tech committed Aug 26, 2024
1 parent d530ac4 commit 0d21153
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/views/ManageList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function ManageList({ listPath }) {
const [itemName, setItemName] = useState('');
const [daysUntilNextPurchase, setDaysUntilNextPurchase] = useState(7);
const [message, setMessage] = useState('');
const [recipentEmail, setRecipientEmail] = useState('');

const handleSubmit = async (event) => {
event.preventDefault();
Expand All @@ -18,6 +19,11 @@ export function ManageList({ listPath }) {
setDaysUntilNextPurchase(7);
};

const handleShare = (event) => {
event.preventDefault();
console.log('shareButtonClick');
};

return (
<div>
<h1>Manage Your Shopping List</h1>
Expand Down Expand Up @@ -63,7 +69,22 @@ export function ManageList({ listPath }) {
<br />
<button type="submit">Add Item</button>
</form>
<br></br>
{message && <p>{message}</p>}

<div>
<form onSubmit={handleShare}>
<label htmlFor="recipientEmail"> Recipient Email: </label>
<input
type="email"
id="recipientEmail"
value={recipentEmail}
onChange={(e) => setRecipientEmail(e.target.value)}
required
/>
<button type="submit">Share List</button>
</form>
</div>
</div>
);
}

0 comments on commit 0d21153

Please sign in to comment.