1
0
ohmyform/ui/components/form/layouts/slider/page.tsx
Michael Schramm 9c4c325e5a
Switch to single branch (#221)
* remove submodules
* add api and ui files
* update github actions
* use sparse checkout
* update node setup
* update checkout
* update docker
* change permissions
* update mariadb health check
* update changelog
2023-12-02 19:22:40 +01:00

70 lines
1.8 KiB
TypeScript

import React from 'react'
import { useTranslation } from 'react-i18next'
import {
FormPublicDesignFragment,
FormPublicPageFragment,
} from '../../../../graphql/fragment/form.public.fragment'
import { StyledButton } from '../../../styled/button'
import { StyledH1 } from '../../../styled/h1'
import { StyledMarkdown } from '../../../styled/markdown'
import { PageButtons } from '../page.buttons'
import scss from './page.module.scss'
interface Props {
page: FormPublicPageFragment
design: FormPublicDesignFragment
className?: string
next: () => void
prev: () => void
}
export const FormPage: React.FC<Props> = ({ page, design, next, prev, className, ...props }) => {
const { t } = useTranslation()
if (!page.show) {
return null
}
return (
<div className={[scss.main, className].filter((c) => !!c).join(' ')} {...props}>
<div className={scss.content}>
<StyledH1 design={design} type={'question'}>
{page.title}
</StyledH1>
<StyledMarkdown design={design} type={'question'}>{page.paragraph}</StyledMarkdown>
</div>
<div
style={{
padding: 32,
display: 'flex',
}}
>
{prev && (
<StyledButton
background={design.colors.button}
color={design.colors.buttonText}
highlight={design.colors.buttonActive}
onClick={prev}
>
{t('form:previous')}
</StyledButton>
)}
<PageButtons buttons={page.buttons} />
<div style={{ flex: 1 }} />
<StyledButton
background={design.colors.button}
color={design.colors.buttonText}
highlight={design.colors.buttonActive}
size={'large'}
onClick={next}
>
{page.buttonText || t('form:continue')}
</StyledButton>
</div>
</div>
)
}