-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(onboarding-ui): create reusable InformationPage (#663)
- Loading branch information
1 parent
50234f4
commit 5285d76
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/onboarding-ui/src/pages/InformationPage/InformationPage.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ReactDOM from 'react-dom'; | ||
|
||
import InformationPage from './InformationPage'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<InformationPage title='' description='' />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/onboarding-ui/src/pages/InformationPage/InformationPage.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Story, Meta } from '@storybook/react'; | ||
import type { ComponentProps } from 'react'; | ||
|
||
import InformationPage from './InformationPage'; | ||
|
||
type Args = ComponentProps<typeof InformationPage>; | ||
|
||
export default { | ||
title: 'pages/InformationPage', | ||
component: InformationPage, | ||
parameters: { | ||
actions: { argTypesRegex: '^on.*' }, | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
title: 'Place your title here', | ||
description: 'Place your description here', | ||
}, | ||
} as Meta<Args>; | ||
|
||
export const _InformationPage: Story<Args> = (args) => ( | ||
<InformationPage {...args} /> | ||
); | ||
_InformationPage.storyName = 'InformationPage'; |
40 changes: 40 additions & 0 deletions
40
packages/onboarding-ui/src/pages/InformationPage/InformationPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Box, Margins } from '@rocket.chat/fuselage'; | ||
import type { ReactElement } from 'react'; | ||
|
||
import BackgroundLayer from '../../common/BackgroundLayer'; | ||
import { OnboardingLogo } from '../../common/OnboardingLogo'; | ||
|
||
type InformationPageProps = { | ||
title: string; | ||
description: string; | ||
}; | ||
|
||
const InformationPage = ({ | ||
title, | ||
description, | ||
}: InformationPageProps): ReactElement => ( | ||
<BackgroundLayer> | ||
<Box | ||
display='flex' | ||
flexDirection='column' | ||
alignItems='center' | ||
textAlign='center' | ||
width='100%' | ||
maxWidth={624} | ||
paddingBlock={32} | ||
paddingInline={16} | ||
> | ||
<Margins blockEnd={32}> | ||
<OnboardingLogo /> | ||
|
||
<Box fontWeight={800} fontSize='x52' lineHeight='x62' fontFamily='sans'> | ||
{title} | ||
</Box> | ||
|
||
<Box fontScale='p1'>{description}</Box> | ||
</Margins> | ||
</Box> | ||
</BackgroundLayer> | ||
); | ||
|
||
export default InformationPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './InformationPage'; |