diff options
author | Michael Hunteman <michael@huntm.net> | 2024-04-26 14:26:46 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-04-26 14:26:46 -0700 |
commit | 60a6a39e5da9841db4a892d1e3a0b00356f08009 (patch) | |
tree | 455fa898e6a16890b8d49e12e43b0c2ef8f69657 /src | |
parent | c67f9987cad34ec1a0a03e72326173d23e3f4360 (diff) |
Show one less than party size
Diffstat (limited to 'src')
-rw-r--r-- | src/components/RsvpForm.tsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/components/RsvpForm.tsx b/src/components/RsvpForm.tsx index b9dd991..9e957f8 100644 --- a/src/components/RsvpForm.tsx +++ b/src/components/RsvpForm.tsx @@ -63,10 +63,10 @@ function RsvpForm() { }); const handleParty = () => { - const partySize = Number(watch('partySize')); + const partySize = Number(watch('partySize')) - 1; if ( partySize > previousPartySize.current && - partySize > 1 && + partySize > 0 && partySize < 10 ) { append( @@ -76,7 +76,7 @@ function RsvpForm() { }) ); previousPartySize.current = partySize; - } else if (partySize < previousPartySize.current && partySize > 0) { + } else if (partySize < previousPartySize.current && partySize >= 0) { remove( [...Array(previousPartySize.current - partySize).keys()].map( (_, i) => partySize - 1 + i |