Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(form-v2/form-instructions-2): pull PublicSwitchEnvMessage into public form wrapper #4323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { FormAuthType } from '~shared/types/form/form'
import { usePublicFormContext } from '~features/public-form/PublicFormContext'

import { FormAuth } from '../FormAuth'
// TODO #4279: Remove after React rollout is complete
import { PublicSwitchEnvMessage } from '../PublicSwitchEnvMessage'

import { FormFields } from './FormFields'
import { FormFieldsSkeleton } from './FormFieldsSkeleton'
Expand Down Expand Up @@ -49,7 +47,6 @@ export const FormFieldsContainer = (): JSX.Element | null => {
<Flex justify="center">
{isAuthRequired ? null : <SectionSidebar />}
<Box w="100%" minW={0} h="fit-content" maxW="57rem">
<PublicSwitchEnvMessage />
{renderFields}
</Box>
{isAuthRequired ? null : <Spacer />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Flex } from '@chakra-ui/react'

import { usePublicFormContext } from '../PublicFormContext'

// TODO #4279: Remove after React rollout is complete
import { PublicSwitchEnvMessage } from './PublicSwitchEnvMessage'

export interface PublicFormWrapperProps {
children: React.ReactNode
}
Expand All @@ -23,6 +26,7 @@ export const PublicFormWrapper = ({

return (
<Flex bg={bgColour} p={{ base: 0, md: '1.5rem' }} flex={1} flexDir="column">
<PublicSwitchEnvMessage />
{children}
</Flex>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO #4279: Remove after React rollout is complete
import { Text } from '@chakra-ui/react'
import { Box, Flex, Text } from '@chakra-ui/react'

import Button from '~components/Button'
import InlineMessage from '~components/InlineMessage'
Expand All @@ -10,14 +10,25 @@ export const PublicSwitchEnvMessage = (): JSX.Element => {
const { publicSwitchEnvMutation } = useEnvMutations()

return (
<InlineMessage variant="warning" mb="1.5rem" mt={{ base: '2rem', md: '0' }}>
<Text>
You’re filling this form on the new FormSG. If you have trouble
submitting,{' '}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking: explicit space wasn't needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops that was my bad! I'll change it in my react-to-angular PR since it should apply to both PublicSwitchEnvMessage and AdminSwitchEnvMessage :)

<Button variant="link" onClick={() => publicSwitchEnvMutation.mutate}>
<Text as="u">switch to the original one here.</Text>
</Button>
</Text>
</InlineMessage>
<Flex justify="center">
<Box w="100%" minW={0} h="fit-content" maxW="57rem">
<InlineMessage
variant="warning"
mb="1.5rem"
mt={{ base: '1.5rem', md: '0' }}
>
<Text>
You're filling this form on the new FormSG. If you have trouble
submitting,
<Button
variant="link"
onClick={() => publicSwitchEnvMutation.mutate}
>
<Text as="u">switch to the original one here.</Text>
</Button>
</Text>
</InlineMessage>
</Box>
</Flex>
)
}