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

chore: replace outdated esrv id link #7438

Merged
Merged
Changes from 2 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 @@ -15,6 +15,7 @@ import { FormAuthType, FormSettings } from '~shared/types/form'

import FormErrorMessage from '~components/FormControl/FormErrorMessage'
import Input from '~components/Input'
import Link from '~components/Link'
import Spinner from '~components/Spinner'

import { useMutateFormSettings } from '../../mutations'
Expand Down Expand Up @@ -60,16 +61,24 @@ export const EsrvcIdBox = ({
return errors.esrvcId ? reset() : onSubmit()
}, [errors, onSubmit, reset])

const renderedHelperText = useMemo(() => {
const renderHelperTextComponent = () => {
switch (settings.authType) {
case FormAuthType.SP:
case FormAuthType.CP:
case FormAuthType.MyInfo:
return 'Contact [email protected] for your e-service ID'
return (
<Text textStyle="body-2" color="secondary.400">
Contact{' '}
<Link isExternal href="https://go.gov.sg/formsg-singpass-contact">
kevin9foong marked this conversation as resolved.
Show resolved Hide resolved
Singpass partner support
</Link>{' '}
for your e-Service ID
</Text>
kevin9foong marked this conversation as resolved.
Show resolved Hide resolved
)
default:
return ''
return null
}
}, [settings.authType])
}

const placeHolder = useMemo(
() =>
Expand All @@ -81,9 +90,7 @@ export const EsrvcIdBox = ({
return (
<form onSubmit={onSubmit} onBlur={handleBlur}>
<Stack ml="2.75rem" mb="1.25rem">
<Text textStyle="body-2" color="secondary.400">
{renderedHelperText}
</Text>
{renderHelperTextComponent()}
<VisuallyHidden>
<FormLabel htmlFor="esrvcId">e-service ID:</FormLabel>
</VisuallyHidden>
Expand Down
Loading