Skip to content

Commit

Permalink
feat: allow storage mode in myinfo form duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlingt committed Nov 7, 2023
1 parent 78c417d commit 8f3556e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Button from '~components/Button'
import FormErrorMessage from '~components/FormControl/FormErrorMessage'
import FormFieldMessage from '~components/FormControl/FormFieldMessage'
import FormLabel from '~components/FormControl/FormLabel'
import InlineMessage from '~components/InlineMessage'
import Input from '~components/Input'

import { useCreateFormWizard } from '../CreateFormWizardContext'
Expand Down Expand Up @@ -79,23 +78,12 @@ export const CreateFormDetailsScreen = (): JSX.Element => {
<Controller
name="responseMode"
control={control}
render={({ field }) => (
<FormResponseOptions
containsMyInfoFields={containsMyInfoFields}
{...field}
/>
)}
render={({ field }) => <FormResponseOptions {...field} />}
rules={{ required: 'Please select a form response mode' }}
/>
</Skeleton>
<FormErrorMessage>{errors.responseMode?.message}</FormErrorMessage>
</FormControl>
{containsMyInfoFields && (
<InlineMessage useMarkdown mt="-1rem" mb="1rem">
{`This form contains MyInfo fields. Only **Email** mode is supported at
this point.`}
</InlineMessage>
)}
{responseModeValue === FormResponseMode.Email && (
<FormControl isRequired isInvalid={!!errors.emails} mb="2.25rem">
<FormLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Badge from '~components/Badge'
import Tile from '~components/Tile'

export interface FormResponseOptionsProps {
containsMyInfoFields: boolean
onChange: (option: FormResponseMode) => void
value: FormResponseMode
}
Expand All @@ -29,15 +28,14 @@ const OptionDescription = ({ listItems = [] }: { listItems: string[] }) => {
export const FormResponseOptions = forwardRef<
FormResponseOptionsProps,
'button'
>(({ value, onChange, containsMyInfoFields }, ref) => {
>(({ value, onChange }, ref) => {
return (
<Stack spacing="1rem" w="100%" direction={{ base: 'column', md: 'row' }}>
<Tile
variant="complex"
icon={BiLockAlt}
badge={<Badge colorScheme="success">Recommended</Badge>}
isActive={value === FormResponseMode.Encrypt}
isDisabled={containsMyInfoFields}
onClick={() => onChange(FormResponseMode.Encrypt)}
isFullWidth
flex={1}
Expand Down

0 comments on commit 8f3556e

Please sign in to comment.