-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react): support org oidc, update docs
- Loading branch information
Showing
15 changed files
with
123 additions
and
103 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
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
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 @@ | ||
# GoogleLoginButton | ||
|
||
When SSO is configured on a workspace, this button can be added to a Nile app the handle SSO login. Optionally, if an `org` property is passed to the component, the user will be added to the organization and then redirected. | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { GoogleLoginButton, NileProvider } from '@theniledev/react'; | ||
|
||
function App() { | ||
return ( | ||
<NileProvider> | ||
<h1>🤩 My Great App🤩</h1> | ||
<h2>Sign in</h2> | ||
<GoogleLoginButton /> | ||
</NileProvider> | ||
); | ||
} | ||
``` |
File renamed without changes
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,89 @@ | ||
import React from 'react'; | ||
import { Button, Typography, Box, Stack } from '@mui/joy'; | ||
|
||
import { useNile } from '../../context'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import GoogleLogo from './google.svg'; | ||
|
||
type LogInGoogleProps = { | ||
org?: string; | ||
}; | ||
/** | ||
* Basic component for a google login form | ||
*/ | ||
export default function LogInGoogle(props: LogInGoogleProps) { | ||
const nile = useNile(); | ||
const { org } = props; | ||
const href = React.useMemo(() => { | ||
if (org) { | ||
return nile.organizations.oidc.GOOGLE(org); | ||
} | ||
return nile.workspaces.oidc.GOOGLE(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [org]); | ||
|
||
return ( | ||
<Box | ||
component="a" | ||
href={href} | ||
sx={{ display: 'flex', flex: 1, textDecoration: 'none' }} | ||
> | ||
<Box> | ||
<Button sx={{ padding: 0, textTransform: 'initial', flex: 1 }}> | ||
<Stack | ||
direction="row" | ||
sx={{ | ||
alignItems: 'center', | ||
display: 'inline-flex', | ||
color: 'rgb(255, 255, 255)', | ||
boxShadow: | ||
'rgb(0 0 0 / 24%) 0px 2px 2px 0px, rgb(0 0 0 / 24%) 0px 0px 1px 0px', | ||
padding: '0px', | ||
borderRadius: '4px', | ||
border: '1px solid transparent', | ||
fontSize: '14px', | ||
fontWeight: '500', | ||
backgroundColor: 'rgb(66, 133, 244)', | ||
fontFamily: 'Roboto, sans-serif', | ||
flex: 1, | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
padding: '11px', | ||
background: 'rgb(255, 255, 255)', | ||
borderTopLeftRadius: '4px', | ||
borderBottomLeftRadius: '4px', | ||
display: 'flex', | ||
border: '1px solid rgb(66, 133, 244)', | ||
borderRadius: '4px', | ||
}} | ||
> | ||
<GoogleLogo /> | ||
</Box> | ||
<Box | ||
sx={{ | ||
padding: '10px', | ||
borderTopRightRadius: '4px', | ||
borderBottomRightRadius: '4px', | ||
flex: 1, | ||
}} | ||
> | ||
<Typography | ||
sx={{ color: 'white' }} | ||
fontWeight={700} | ||
fontFamily="Roboto, sans-serif" | ||
fontSize="14px" | ||
height="20px" | ||
> | ||
Continue with Google | ||
</Typography> | ||
</Box> | ||
</Stack> | ||
</Button> | ||
</Box> | ||
</Box> | ||
); | ||
} |
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
73 changes: 0 additions & 73 deletions
73
packages/react/src/components/LoginForm/GoogleLoginButton.tsx
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
1e3ef0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-storybook – ./
react-storybook-theniledev.vercel.app
storybook.thenile.dev
react-storybook-ten.vercel.app
react-storybook-git-master-theniledev.vercel.app
1e3ef0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nile-js – ./
nile-js-git-master-theniledev.vercel.app
nile-js-theniledev.vercel.app
nile-js.vercel.app