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

feat(onboarding-ui): allow title and subtitle editing #665

Merged
merged 4 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
@@ -1,3 +1,4 @@
import { action } from '@storybook/addon-actions';
import type { Story, Meta } from '@storybook/react';
import type { ComponentProps } from 'react';

Expand All @@ -12,6 +13,12 @@ export default {
actions: { argTypesRegex: '^on.*' },
layout: 'fullscreen',
},
args: {
title: '',
children: '',
onResendEmailRequest: action('onResendEmailRequest'),
onChangeEmailRequest: action('onChangeEmailRequest'),
},
} as Meta<Args>;

export const _CheckYourEmailPage: Story<Args> = (args) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
import { Box, Margins } from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import type { ReactElement, ReactNode } from 'react';
import { useTranslation, Trans } from 'react-i18next';

import BackgroundLayer from '../../common/BackgroundLayer';
import EmailCodeFallback from '../../common/EmailCodeFallback';
import { OnboardingLogo } from '../../common/OnboardingLogo';

type CheckYourEmailPageProps = {
title?: string;
children?: ReactNode;
onResendEmailRequest: () => void;
onChangeEmailRequest: () => void;
};

const CheckYourEmailPage = ({
title,
children,
onResendEmailRequest,
onChangeEmailRequest,
}: CheckYourEmailPageProps): ReactElement => {
const { t } = useTranslation();

const defaultSubtitleComponent = (
<Trans i18nKey='page.checkYourEmail.subtitle'>
Your request has been sent successfully.
<br />
Check your email inbox to launch your Enterprise trial.
</Trans>
);

title = title || t('page.checkYourEmail.title');
children = children || defaultSubtitleComponent;

return (
<BackgroundLayer>
<Box
Expand All @@ -38,16 +53,10 @@ const CheckYourEmailPage = ({
lineHeight='x62'
fontFamily='sans'
>
{t('page.checkYourEmail.title')}
{title}
</Box>

<Box fontScale='p1'>
<Trans i18nKey='page.checkYourEmail.subtitle'>
Your request has been sent successfully.
<br />
Check your email inbox to launch your Enterprise trial.
</Trans>
</Box>
<Box fontScale='p1'>{children}</Box>

<EmailCodeFallback
onResendEmailRequest={onResendEmailRequest}
Expand Down