Skip to content

Commit

Permalink
ref: genericize EndPageBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
justynoh committed Apr 3, 2024
1 parent 7342138 commit 017cfb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const FormEndPage = ({
focusOnMount
{...endPageProps}
colorTheme={colorTheme}
previousSubmissionId={previousSubmissionId}
isButtonHidden={!!previousSubmissionId}
/>
{isFeedbackSectionHidden ? null : (
<FeedbackBlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface EndPageBlockProps {
submissionData: SubmissionData
colorTheme?: FormColorTheme
focusOnMount?: boolean
previousSubmissionId?: string
isButtonHidden?: boolean
}

export const EndPageBlock = ({
Expand All @@ -25,7 +25,7 @@ export const EndPageBlock = ({
submissionData,
colorTheme = FormColorTheme.Blue,
focusOnMount,
previousSubmissionId,
isButtonHidden,
}: EndPageBlockProps): JSX.Element => {
const focusRef = useRef<HTMLDivElement>(null)
useEffect(() => {
Expand Down Expand Up @@ -55,8 +55,6 @@ export const EndPageBlock = ({
return 'You have successfully submitted your response.'
}, [formTitle])

const disableSubmitResponseButton = !!previousSubmissionId //disable for MRF 2nd respondent onwards

return (
<>
<Box ref={focusRef}>
Expand Down Expand Up @@ -84,7 +82,7 @@ export const EndPageBlock = ({
</Text>
</Box>
<Box mt="2.25rem">
{disableSubmitResponseButton || (
{isButtonHidden || (
<Button
as="a"
href={endPage.buttonLink || window.location.href}
Expand Down

0 comments on commit 017cfb3

Please sign in to comment.