-
Notifications
You must be signed in to change notification settings - Fork 167
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): add oauth auth page (#586)
* feat(onboarding-ui): add Oauth Auth Page * chore: update loki screenshots * chore: remove tag cloud from logo * chore: update loki screenshots
- Loading branch information
1 parent
f443a11
commit 4a7ae0b
Showing
9 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+73.3 KB
....loki/reference/desktop_pages_OauthAuthorizationPage_OauthAuthorizationPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+65.5 KB
.../.loki/reference/mobile_pages_OauthAuthorizationPage_OauthAuthorizationPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.4 KB
.../.loki/reference/tablet_pages_OauthAuthorizationPage_OauthAuthorizationPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
19 changes: 19 additions & 0 deletions
19
packages/onboarding-ui/src/pages/OauthAuthorizationPage/OauthAuthorizationPage.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,19 @@ | ||
import ReactDOM from 'react-dom'; | ||
|
||
import OauthAuthorizationPage from './OauthAuthorizationPage'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render( | ||
<OauthAuthorizationPage | ||
clientName={undefined} | ||
onClickAuthorizeOAuth={() => undefined} | ||
error={{ | ||
message: undefined, | ||
onGoBack: () => undefined, | ||
}} | ||
/>, | ||
div | ||
); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
28 changes: 28 additions & 0 deletions
28
packages/onboarding-ui/src/pages/OauthAuthorizationPage/OauthAuthorizationPage.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,28 @@ | ||
import type { Story, Meta } from '@storybook/react'; | ||
import type { ComponentProps } from 'react'; | ||
|
||
import OauthAuthorizationPage from './OauthAuthorizationPage'; | ||
|
||
type Args = ComponentProps<typeof OauthAuthorizationPage>; | ||
|
||
export default { | ||
title: 'pages/OauthAuthorizationPage', | ||
component: OauthAuthorizationPage, | ||
parameters: { | ||
actions: { argTypesRegex: '^on.*' }, | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
clientName: 'Rocket.Chat', | ||
error: { | ||
message: '', | ||
onGoBack: () => console.log('Back'), | ||
}, | ||
}, | ||
} as Meta<Args>; | ||
|
||
export const _OauthAuthorizationPage: Story<Args> = (args) => ( | ||
<OauthAuthorizationPage {...args} /> | ||
); | ||
|
||
_OauthAuthorizationPage.storyName = 'OauthAuthorizationPage'; |
90 changes: 90 additions & 0 deletions
90
packages/onboarding-ui/src/pages/OauthAuthorizationPage/OauthAuthorizationPage.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,90 @@ | ||
import { Box, Button } from '@rocket.chat/fuselage'; | ||
import colors from '@rocket.chat/fuselage-tokens/colors.json'; | ||
import type { ReactElement } from 'react'; | ||
import { Trans, useTranslation } from 'react-i18next'; | ||
|
||
import BackgroundLayer from '../../common/BackgroundLayer'; | ||
import { OnboardingLogo } from '../../common/OnboardingLogo'; | ||
|
||
type OauthAuthorizationPageProps = { | ||
clientName?: string; | ||
onClickAuthorizeOAuth: () => void; | ||
error: { | ||
message?: string; | ||
onGoBack?: () => void; | ||
}; | ||
}; | ||
|
||
const OauthAuthorizationPage = ({ | ||
clientName, | ||
onClickAuthorizeOAuth, | ||
error, | ||
}: OauthAuthorizationPageProps): ReactElement => { | ||
const { t } = useTranslation(); | ||
|
||
const name = clientName || '...loading...'; | ||
|
||
return ( | ||
<BackgroundLayer> | ||
<Box | ||
display='flex' | ||
flexDirection='column' | ||
alignItems='center' | ||
textAlign='center' | ||
width='100%' | ||
maxWidth={576} | ||
paddingBlock={32} | ||
paddingInline={16} | ||
> | ||
<OnboardingLogo /> | ||
<Box | ||
fontWeight={500} | ||
width='100%' | ||
mbs='x24' | ||
mbe='x36' | ||
fontSize='x57' | ||
lineHeight='x62' | ||
fontFamily='sans' | ||
> | ||
{t('page.oauthAuthorizationPage.title')} | ||
</Box> | ||
<Box width='full' backgroundColor='white'> | ||
<Box fontScale='p1' p='x40' textAlign='start' color={colors.n900}> | ||
{error.message ? ( | ||
<> | ||
<Box fontScale='h1' mbe='x18'> | ||
Error | ||
</Box> | ||
{error.message} | ||
<Box mbs='x24'> | ||
<Button onClick={error.onGoBack} primary> | ||
{t('page.oauthAuthorizationPage.buttons.goBack')} | ||
</Button> | ||
</Box> | ||
</> | ||
) : ( | ||
<> | ||
<Trans | ||
i18nKey='page.oauthAuthorizationPage.allowLogin' | ||
name={name} | ||
> | ||
Do you wish to allow | ||
<strong>{{ name }}</strong> | ||
to login with your Rocket.Chat Cloud Account? | ||
</Trans> | ||
|
||
<Box mbs='x24'> | ||
<Button onClick={onClickAuthorizeOAuth} primary> | ||
{t('page.oauthAuthorizationPage.buttons.authorize')} | ||
</Button> | ||
</Box> | ||
</> | ||
)} | ||
</Box> | ||
</Box> | ||
</Box> | ||
</BackgroundLayer> | ||
); | ||
}; | ||
|
||
export default OauthAuthorizationPage; |
1 change: 1 addition & 0 deletions
1
packages/onboarding-ui/src/pages/OauthAuthorizationPage/index.ts
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 './OauthAuthorizationPage'; |