Skip to content

Commit

Permalink
Merge branch 'develop' into new/cloud-orgInfo-page
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Jul 23, 2021
2 parents d2a4a2f + 7557dce commit 474f35a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/onboarding-ui/.i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
"password": {
"label": "Password",
"placeholder": "Create password"
},
"keepPosted": {
"label": "Keep me posted about Rocket.Chat updates"
}
}
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/onboarding-ui/src/common/FormPageLayout.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const Title = styled('div')`

export const Subtitle = styled('div')`
font-size: ${String(40 / 16)}rem;
font-family: ${sans};
line-height: ${String(42 / 16)}rem;
text-align: center;
Expand All @@ -84,6 +85,7 @@ export const Subtitle = styled('div')`

export const Description = styled('div')`
display: none;
font-family: ${sans};
@media (min-width: 1440px) {
display: unset;
Expand Down
13 changes: 13 additions & 0 deletions packages/onboarding-ui/src/forms/AdminInfoForm/AdminInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Button,
PasswordInput,
TextInput,
Box,
CheckBox,
} from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import { useForm, SubmitHandler, Validate } from 'react-hook-form';
Expand All @@ -18,12 +20,14 @@ export type AdminInfoPayload = {
username: string;
companyEmail: string;
password: string;
keepPosted: boolean;
};

type AdminInfoFormProps = {
currentStep: number;
stepCount: number;
passwordRulesHint: string;
keepPosted?: boolean;
initialValues?: Omit<AdminInfoPayload, 'password'>;
validateUsername: Validate<string>;
validateEmail: Validate<string>;
Expand All @@ -39,6 +43,7 @@ const AdminInfoForm = ({
validateUsername,
validateEmail,
validatePassword,
keepPosted = false,
onSubmit,
}: AdminInfoFormProps): ReactElement => {
const { t } = useTranslation();
Expand Down Expand Up @@ -137,6 +142,14 @@ const AdminInfoForm = ({
<Field.Error>{errors.password.message}</Field.Error>
)}
</Field>
{keepPosted && (
<Box mbe='x8' display='block' color='info' fontScale='c1'>
<CheckBox id='keepPosted' mie='x8' {...register('keepPosted')} />
<label htmlFor='keepPosted'>
{t('form.adminInfoForm.fields.keepPosted.label')}
</label>
</Box>
)}
</FieldGroup>
</Form.Container>
<Form.Footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@ export default {
export const _AdminInfoPage: Story<Args> = (args) => (
<AdminInfoPage {...args} />
);

export const _CloudAdminInfoPage: Story<Args> = (args) => (
<AdminInfoPage {...args} />
);

_AdminInfoPage.storyName = 'AdminInfoPage';
_CloudAdminInfoPage.storyName = 'CloudAdminInfoPage';

_CloudAdminInfoPage.args = {
title: 'Your Workspace is Ready!',
description: 'Time to create your first admin user',
keepPosted: true,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactElement } from 'react';
import type { ReactElement, ReactNode } from 'react';
import type { SubmitHandler, Validate } from 'react-hook-form';

import BackgroundLayer from '../../common/BackgroundLayer';
Expand All @@ -7,9 +7,12 @@ import AdminInfoForm from '../../forms/AdminInfoForm';
import type { AdminInfoPayload } from '../../forms/AdminInfoForm/AdminInfoForm';

type AdminInfoPageProps = {
title?: ReactNode;
description?: ReactNode;
currentStep: number;
stepCount: number;
passwordRulesHint: string;
keepPosted?: boolean;
initialValues?: Omit<AdminInfoPayload, 'password'>;
validateUsername: Validate<string>;
validateEmail: Validate<string>;
Expand All @@ -19,7 +22,7 @@ type AdminInfoPageProps = {

const AdminInfoPage = (props: AdminInfoPageProps): ReactElement => (
<BackgroundLayer>
<FormPageLayout>
<FormPageLayout title={props.title} description={props.description}>
<AdminInfoForm {...props} />
</FormPageLayout>
</BackgroundLayer>
Expand Down

0 comments on commit 474f35a

Please sign in to comment.