Skip to content

Commit

Permalink
feat(request-trial): add checkbox to confirm terms and conditions (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujorgeleite committed Jan 27, 2022
1 parent 147f8a1 commit f289d01
Showing 1 changed file with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
Button,
Field,
Box,
CheckBox,
FieldGroup,
TextInput,
EmailInput,
Expand All @@ -10,7 +12,7 @@ import {
} from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import { useForm, SubmitHandler, Validate, Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { useTranslation, Trans } from 'react-i18next';

import Form from '../../common/Form';

Expand All @@ -19,6 +21,8 @@ type RequestTrialPayload = {
organizationName: string;
organizationSize: string;
country: string;
updates: boolean;
agreement: boolean;
};

type RequestTrialFormProps = {
Expand All @@ -28,6 +32,8 @@ type RequestTrialFormProps = {
onSubmit: SubmitHandler<RequestTrialPayload>;
onManageWorkspaceClick: () => void;
validateEmail: Validate<string>;
termsHref?: string;
policyHref?: string;
};

const RequestTrialForm = ({
Expand All @@ -36,6 +42,8 @@ const RequestTrialForm = ({
countryOptions,
onSubmit,
validateEmail,
termsHref = 'https://rocket.chat/terms',
policyHref = 'https://rocket.chat/privacy',
}: RequestTrialFormProps): ReactElement => {
const { t } = useTranslation();

Expand Down Expand Up @@ -131,6 +139,53 @@ const RequestTrialForm = ({
/>
</Field.Row>
</Field>
<Field>
<Box mbs='x24'>
<Box
mbe='x8'
display='flex'
flexDirection='row'
alignItems='flex-start'
fontScale='c1'
lineHeight={20}
>
<CheckBox mie='x8' {...register('updates')} />{' '}
<Box is='label' htmlFor='updates'>
{t('form.registeredServerForm.keepInformed')}
</Box>
</Box>
<Box
display='flex'
flexDirection='row'
alignItems='flex-start'
color='default'
fontScale='c1'
lineHeight={20}
>
<CheckBox
mie='x8'
{...register('agreement', { required: true })}
/>{' '}
<Box is='label' htmlFor='agreement' withRichContent>
<Trans i18nKey='component.form.termsAndConditions'>
I agree with
<a href={termsHref} target='_blank' rel='noopener noreferrer'>
Terms and Conditions
</a>
and
<a
href={policyHref}
target='_blank'
rel='noopener noreferrer'
>
Privacy Policy
</a>
</Trans>
</Box>
</Box>
</Box>
</Field>

<Field>
<Field.Label>
{t('form.requestTrialForm.hasWorkspace.label')}
Expand Down

0 comments on commit f289d01

Please sign in to comment.