Skip to content

Commit

Permalink
new: CloudOrganizationInfoPage Story
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Jul 15, 2021
1 parent be3185f commit faae684
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/onboarding-ui/.i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"steps": "Step {{currentStep}} of {{stepCount}}",
"action": {
"back": "Back",
"next": "Next"
"next": "Next",
"skip": "Skip this step"
},
"requiredField": "This field is required"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TextInput,
Select,
SelectOptions,
Box,
} from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import { useForm, SubmitHandler, Controller } from 'react-hook-form';
Expand All @@ -28,8 +29,10 @@ type OrganizationInfoFormProps = {
organizationIndustryOptions: SelectOptions;
organizationSizeOptions: SelectOptions;
countryOptions: SelectOptions;
onConfirmText?: string;
onSubmit: SubmitHandler<OrganizationInfoFormInputs>;
onBackButtonClick: () => void;
onClickSkip?: () => void;
};

const OrganizationInfoForm = ({
Expand All @@ -39,8 +42,10 @@ const OrganizationInfoForm = ({
organizationIndustryOptions,
organizationSizeOptions,
countryOptions,
onConfirmText,
onSubmit,
onBackButtonClick,
onClickSkip,
}: OrganizationInfoFormProps): ReactElement => {
const { t } = useTranslation();

Expand Down Expand Up @@ -166,8 +171,18 @@ const OrganizationInfoForm = ({
primary
disabled={!isDirty || isValidating || isSubmitting}
>
{t('component.form.action.next')}
{onConfirmText || t('component.form.action.next')}
</Button>

{onClickSkip && (
<Box flexGrow={1}>
<ButtonGroup flexGrow={1} align='end'>
<Button nude info onClick={onClickSkip}>
{t('component.form.action.skip')}
</Button>
</ButtonGroup>
</Box>
)}
</ButtonGroup>
</Form.Footer>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,16 @@ export default {
export const _OrganizationInfoPage: Story<Args> = (args) => (
<OrganizationInfoPage {...args} />
);

_OrganizationInfoPage.storyName = 'OrganizationInfoPage';

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

_CloudOrganizationInfoPage.storyName = 'CloudOrganizationInfoPage';
_CloudOrganizationInfoPage.args = {
title: 'Your Workspace is Ready!',
description: 'Organization info will help us personalize your workspace',
onConfirmText: 'Go to workspace',
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import FormPageLayout from '../../common/FormPageLayout';
import OrganizationInfoForm from '../../forms/OrganizationInfoForm';

type OrganizationInfoPageProps = {
title?: string;
description?: string;
currentStep: number;
stepCount: number;
organizationTypeOptions: (readonly [string, string])[];
Expand All @@ -20,13 +22,15 @@ type OrganizationInfoPageProps = {
country: string;
}>;
onBackButtonClick: () => void;
onConfirmText?: string;
onClickSkip?: () => void;
};

const OrganizationInfoPage = (
props: OrganizationInfoPageProps
): ReactElement => (
<BackgroundLayer>
<FormPageLayout>
<FormPageLayout title={props.title} description={props.description}>
<OrganizationInfoForm {...props} />
</FormPageLayout>
</BackgroundLayer>
Expand Down

0 comments on commit faae684

Please sign in to comment.