Skip to content

Commit

Permalink
put skip button, still has to be tested in a script
Browse files Browse the repository at this point in the history
  • Loading branch information
trbKnl committed Mar 7, 2024
1 parent abf7941 commit d17b0b7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/framework/visualisation/react/ui/pages/donation_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ import {
isPropsUIPromptQuestionnaire
} from '../../../../types/prompts'
import { ReactFactoryContext } from '../../factory'
import { ForwardButton } from '../elements/button'
import { Title1 } from '../elements/text'
import { Confirm } from '../prompts/confirm'
import { ConsentForm } from '../prompts/consent_form'
import { FileInput } from '../prompts/file_input'
import { Questionnaire } from '../prompts/questionnaire'
import { RadioInput } from '../prompts/radio_input'
import { Footer } from './templates/footer'
import { Page } from './templates/page'

type Props = Weak<PropsUIPageDonation> & ReactFactoryContext

export const DonationPage = (props: Props): JSX.Element => {
const { title } = prepareCopy(props)
const { locale } = props
const { title, forwardButton } = prepareCopy(props)
const { locale, resolve } = props

function renderBody (props: Props): JSX.Element {
const context = { locale: locale, resolve: props.resolve }
Expand All @@ -46,6 +48,27 @@ export const DonationPage = (props: Props): JSX.Element => {
throw new TypeError('Unknown body type')
}

function handleSkip (): void {
resolve?.({ __type__: 'PayloadFalse', value: false })
}

function renderFooter (): JSX.Element {
return <Footer
right={
<div className='flex flex-row'>
<div className='flex-grow' />
<ForwardButton label={forwardButton} onClick={handleSkip} />
</div>
} />
}

const footer: JSX.Element = (
<>
{renderFooter()}
</>
)


const body: JSX.Element = (
<>
<Title1 text={title} />
Expand All @@ -54,9 +77,7 @@ export const DonationPage = (props: Props): JSX.Element => {
)

return (
<Page
body={body}
/>
<Page body={body} footer={footer}/>
)
}

Expand Down
26 changes: 26 additions & 0 deletions src/framework/visualisation/react/ui/pages/templates/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
interface FooterProps {
left?: JSX.Element
middle?: JSX.Element
right?: JSX.Element
}

export const Footer = ({ left, middle, right }: FooterProps): JSX.Element => {
return (
<>
<div className='bg-grey4 h-px' />
<div className='h-full flex flex-col justify-center'>
<div className='flex flex-row gap-4 px-14'>
<div className='w-1/3'>
{left}
</div>
<div className='w-1/3'>
{middle}
</div>
<div className='w-1/3'>
{right}
</div>
</div>
</div>
</>
)
}
4 changes: 4 additions & 0 deletions src/framework/visualisation/react/ui/pages/templates/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
interface PageProps {
body: JSX.Element
footer?: JSX.Element
}

export const Page = (props: PageProps): JSX.Element => {
return (
<div className='w-full h-full'>
{props.body}
{props.footer != null && (
<div className='h-footer flex-shrink-0 mt-5'>{props.footer}</div>
)}
</div>
)
}

0 comments on commit d17b0b7

Please sign in to comment.