Skip to content

Commit 7557dce

Browse files
authored
feat(onboarding-ui): AdminInfoPage for Cloud Registration wizard (#497)
* new: CloudAdminInfo Story * fix: review
1 parent e47d579 commit 7557dce

8 files changed

+35
-2
lines changed

packages/onboarding-ui/.i18n/en.i18n.json

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
"password": {
5454
"label": "Password",
5555
"placeholder": "Create password"
56+
},
57+
"keepPosted": {
58+
"label": "Keep me posted about Rocket.Chat updates"
5659
}
5760
}
5861
},
Loading
Loading
Loading

packages/onboarding-ui/src/common/FormPageLayout.styles.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const Title = styled('div')`
7373

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

8586
export const Description = styled('div')`
8687
display: none;
88+
font-family: ${sans};
8789
8890
@media (min-width: 1440px) {
8991
display: unset;

packages/onboarding-ui/src/forms/AdminInfoForm/AdminInfoForm.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
Button,
77
PasswordInput,
88
TextInput,
9+
Box,
10+
CheckBox,
911
} from '@rocket.chat/fuselage';
1012
import type { ReactElement } from 'react';
1113
import { useForm, SubmitHandler, Validate } from 'react-hook-form';
@@ -18,12 +20,14 @@ export type AdminInfoPayload = {
1820
username: string;
1921
companyEmail: string;
2022
password: string;
23+
keepPosted: boolean;
2124
};
2225

2326
type AdminInfoFormProps = {
2427
currentStep: number;
2528
stepCount: number;
2629
passwordRulesHint: string;
30+
keepPosted?: boolean;
2731
initialValues?: Omit<AdminInfoPayload, 'password'>;
2832
validateUsername: Validate<string>;
2933
validateEmail: Validate<string>;
@@ -39,6 +43,7 @@ const AdminInfoForm = ({
3943
validateUsername,
4044
validateEmail,
4145
validatePassword,
46+
keepPosted = false,
4247
onSubmit,
4348
}: AdminInfoFormProps): ReactElement => {
4449
const { t } = useTranslation();
@@ -137,6 +142,14 @@ const AdminInfoForm = ({
137142
<Field.Error>{errors.password.message}</Field.Error>
138143
)}
139144
</Field>
145+
{keepPosted && (
146+
<Box mbe='x8' display='block' color='info' fontScale='c1'>
147+
<CheckBox id='keepPosted' mie='x8' {...register('keepPosted')} />
148+
<label htmlFor='keepPosted'>
149+
{t('form.adminInfoForm.fields.keepPosted.label')}
150+
</label>
151+
</Box>
152+
)}
140153
</FieldGroup>
141154
</Form.Container>
142155
<Form.Footer>

packages/onboarding-ui/src/pages/AdminInfoPage/AdminInfoPage.stories.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,16 @@ export default {
2727
export const _AdminInfoPage: Story<Args> = (args) => (
2828
<AdminInfoPage {...args} />
2929
);
30+
31+
export const _CloudAdminInfoPage: Story<Args> = (args) => (
32+
<AdminInfoPage {...args} />
33+
);
34+
3035
_AdminInfoPage.storyName = 'AdminInfoPage';
36+
_CloudAdminInfoPage.storyName = 'CloudAdminInfoPage';
37+
38+
_CloudAdminInfoPage.args = {
39+
title: 'Your Workspace is Ready!',
40+
description: 'Time to create your first admin user',
41+
keepPosted: true,
42+
};

packages/onboarding-ui/src/pages/AdminInfoPage/AdminInfoPage.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReactElement } from 'react';
1+
import type { ReactElement, ReactNode } from 'react';
22
import type { SubmitHandler, Validate } from 'react-hook-form';
33

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

99
type AdminInfoPageProps = {
10+
title?: ReactNode;
11+
description?: ReactNode;
1012
currentStep: number;
1113
stepCount: number;
1214
passwordRulesHint: string;
15+
keepPosted?: boolean;
1316
initialValues?: Omit<AdminInfoPayload, 'password'>;
1417
validateUsername: Validate<string>;
1518
validateEmail: Validate<string>;
@@ -19,7 +22,7 @@ type AdminInfoPageProps = {
1922

2023
const AdminInfoPage = (props: AdminInfoPageProps): ReactElement => (
2124
<BackgroundLayer>
22-
<FormPageLayout>
25+
<FormPageLayout title={props.title} description={props.description}>
2326
<AdminInfoForm {...props} />
2427
</FormPageLayout>
2528
</BackgroundLayer>

0 commit comments

Comments
 (0)