Skip to content

Commit

Permalink
Show spinner when donating
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed Dec 10, 2023
1 parent 4d26a95 commit eecccfd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const ConsentForm = (props: Props): JSX.Element => {
const tablesIn = React.useRef<Array<PropsUITable & TableContext>>(parseTables(props.tables))
const metaTables = React.useRef<Array<PropsUITable & TableContext>>(parseTables(props.metaTables))
const tablesOut = React.useRef<Array<PropsUITable & TableContext>>(tablesIn.current)
const [waiting, setWaiting] = React.useState<boolean>(false)

const { locale, resolve } = props
const { description, donateQuestion, donateButton, cancelButton } = prepareCopy(props)
Expand Down Expand Up @@ -101,6 +102,7 @@ export const ConsentForm = (props: Props): JSX.Element => {
}

function handleDonate (): void {
setWaiting(true)
const value = serializeConsentData()
resolve?.({ __type__: 'PayloadJSON', value })
}
Expand Down Expand Up @@ -155,7 +157,7 @@ export const ConsentForm = (props: Props): JSX.Element => {
<div>
<BodyLarge margin='' text={donateQuestion} />
<div className='flex flex-row gap-4 mt-4 mb-4'>
<PrimaryButton label={donateButton} onClick={handleDonate} color='bg-success text-white' />
<PrimaryButton label={donateButton} onClick={handleDonate} color='bg-success text-white' spinning={waiting} />
<LabelButton label={cancelButton} onClick={handleCancel} color='text-grey1' />
</div>
</div>
Expand Down

0 comments on commit eecccfd

Please sign in to comment.