Compare commits

..

No commits in common. "4b9e0627be5e62001afdff5b0933805273046ca9" and "059265098573f4c75a526a95c90fe6de904b2c03" have entirely different histories.

4 changed files with 693 additions and 257 deletions

891
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,8 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
@ -35,7 +35,6 @@
]
},
"devDependencies": {
"html-react-parser": "^5.2.5",
"react-imask": "^7.6.1"
"html-react-parser": "^5.2.5"
}
}

View file

@ -1,5 +1,4 @@
import { useState, useRef } from 'react';
import { IMaskInput } from 'react-imask';
const CentsInADollar = 100;
const DefaultTotal = 0;
@ -22,11 +21,12 @@ function BandForm({ band }) {
const formData = new FormData(formRef.current);
const ticketQuantities = formData.getAll('ticketQuantity');
const total = ticketQuantities.reduce((total, quantity, index) => {
return total += (band.ticketTypes[index].cost * quantity);
}, 0)
setTotal(total > 0 ? total : 0)
setTotal(
ticketQuantities.reduce((total, quantity, index) => {
return total += (band.ticketTypes[index].cost * quantity);
}, 0)
)
}
return (
@ -50,7 +50,6 @@ function BandForm({ band }) {
id={name}
type="number"
step="1"
min="0"
onChange={ticketQuantityChanged}
/>
</div>
@ -67,14 +66,12 @@ function BandForm({ band }) {
<div className="information">
<div className="form-row">
<input
required
name="first_name"
label="First Name"
placeholder="First Name"
type="text"
/>
<input
required
name="last_name"
label="Last Name"
placeholder="Last Name"
@ -82,8 +79,6 @@ function BandForm({ band }) {
/>
</div>
<input
required
{/* TODO: third party library address verification */}
name="address"
label="Address"
placeholder="Address"
@ -93,39 +88,6 @@ function BandForm({ band }) {
<fieldset className="payment">
<legend>Payment Details</legend>
<IMaskInput
required
mask="0000 0000 0000 0000"
{/* TODO: regex pattern */}
name="cardNumber"
label="Card Number"
placeholder="0000 0000 0000 0000"
type="text"
></IMaskInput>
<div className="form-row">
<IMaskInput
required
{/* TODO: regex pattern */}
mask="00 / 00"
pattern="\d*"
name="cardExpiration"
label="Card Expiration (MM/YY)"
placeholder="MM / YY"
type="text"
></IMaskInput>
<IMaskInput
required
{/* TODO: regex pattern */}
mask={Number}
name="cardCVV"
label="Card CVV"
placeholder="CVV"
type="text"
></IMaskInput>
</div>
</fieldset>
<button type="submit" disabled={formIsPending}>Get Tickets</button>

View file

@ -112,9 +112,5 @@ h4 {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
legend {
margin-bottom: var(--spacing-md);
}
}
}