Skip to content

Commit

Permalink
fix: add different padding for edit vs preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kathleenkhy committed Feb 22, 2024
1 parent 0577fb1 commit 95fd061
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useRef } from 'react'
import { Box, VisuallyHidden } from '@chakra-ui/react'
import { Box, useBreakpointValue, VisuallyHidden } from '@chakra-ui/react'

Check warning on line 2 in frontend/src/features/admin-form/create/end-page/PaymentEndPageBlock.tsx

View workflow job for this annotation

GitHub Actions / frontend_lint

'useBreakpointValue' is defined but never used

import {
AdminStorageFormDto,
Expand All @@ -18,12 +18,14 @@ export interface PaymentEndPageBlockProps {
endPage: FormDto['endPage']
submissionData: SubmissionData
focusOnMount?: boolean
useLargeMarginX?: boolean
}

export const PaymentEndPageBlock = ({
endPage,
submissionData,
focusOnMount,
useLargeMarginX,
}: PaymentEndPageBlockProps): JSX.Element => {
const { data: form } = useAdminForm()
const focusRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -56,8 +58,12 @@ export const PaymentEndPageBlock = ({
form as AdminStorageFormDto,
)

const mxValue = useLargeMarginX
? { base: '1rem', md: '4rem' }
: { base: '1rem', md: '0' }

return (
<Box mx={{ base: '1rem', md: '4rem' }}>
<Box mx={mxValue}>
<Box ref={focusRef} bg="white">
<VisuallyHidden aria-live="assertive">
{submittedAriaText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export const PaymentEndPagePreview = ({
pt={{ base: '1rem', md: '1.5rem' }}
mx={{ base: '1rem', md: '2rem' }}
bg="transparent"
width="100%"
w="100%"
>
<PaymentEndPageBlock {...endPageProps} />
<PaymentEndPageBlock {...endPageProps} useLargeMarginX />
<Stack px={{ base: '1rem', md: '4rem' }} bg="transparent">
{isFeedbackSubmitted ? null : (
<Box
Expand Down

0 comments on commit 95fd061

Please sign in to comment.