-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate team invite signup to React - Part II (Front-end) (#3300)
Co-authored-by: Michael Matloka <[email protected]>
- Loading branch information
1 parent
e50980c
commit e35ef9d
Showing
35 changed files
with
1,353 additions
and
170 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
@import '~/vars'; | ||
|
||
$google: #4285f4; | ||
$github: #171516; | ||
$gitlab: #e65328; | ||
|
||
.social-logins { | ||
margin-bottom: $default_spacing; | ||
margin-top: $default_spacing; | ||
text-align: center; | ||
|
||
button, | ||
a { | ||
margin-bottom: $default_spacing / 2; | ||
} | ||
|
||
.caption { | ||
margin-bottom: $default_spacing / 2; | ||
color: $text_muted; | ||
} | ||
} | ||
|
||
.btn-social-login { | ||
color: white; | ||
border: 0; | ||
font-weight: bold; | ||
position: relative; | ||
padding-left: 60px; | ||
padding-right: 32px; // 60px - 28px (icon width) | ||
|
||
&:hover { | ||
color: white; | ||
} | ||
|
||
&.google-oauth2 { | ||
background-color: $google; | ||
|
||
&:hover { | ||
background-color: lighten($google, 12%); | ||
} | ||
|
||
.btn-social-icon .img { | ||
background-image: url('./google.svg'); | ||
} | ||
} | ||
|
||
&.github { | ||
background-color: $github; | ||
&:hover { | ||
background-color: lighten($github, 12%); | ||
} | ||
|
||
.btn-social-icon .img { | ||
background-image: url('./github.svg'); | ||
} | ||
} | ||
|
||
&.gitlab { | ||
background-color: $gitlab; | ||
&:hover { | ||
background-color: lighten($gitlab, 12%); | ||
} | ||
|
||
.btn-social-icon .img { | ||
background-image: url('./gitlab.svg'); | ||
} | ||
} | ||
|
||
.btn-social-icon { | ||
background-color: white; | ||
border-radius: $radius; | ||
height: 28px; | ||
width: 28px; | ||
position: absolute; | ||
left: 2px; | ||
top: 2px; | ||
.img { | ||
background-position: center center; | ||
background-repeat: no-repeat; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
} | ||
} |
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,70 @@ | ||
import { Button } from 'antd' | ||
import { useValues } from 'kea' | ||
import React from 'react' | ||
import { preflightLogic } from 'scenes/PreflightCheck/logic' | ||
import './index.scss' | ||
|
||
enum SocialAuthProviders { | ||
Google = 'google-oauth2', | ||
GitHub = 'github', | ||
GitLab = 'gitlab', | ||
} | ||
|
||
const ProviderNames: Record<SocialAuthProviders, string> = { | ||
[SocialAuthProviders.Google]: 'Google', | ||
[SocialAuthProviders.GitHub]: 'GitHub', | ||
[SocialAuthProviders.GitLab]: 'GitLab', | ||
} | ||
|
||
interface SharedProps { | ||
queryString?: string | ||
} | ||
|
||
interface SocialLoginButtonProps extends SharedProps { | ||
provider: SocialAuthProviders | ||
} | ||
|
||
interface SocialLoginButtonsProps extends SharedProps { | ||
title?: string | ||
caption?: string | ||
} | ||
|
||
export function SocialLoginButton({ provider, queryString }: SocialLoginButtonProps): JSX.Element | null { | ||
const { preflight } = useValues(preflightLogic) | ||
|
||
if (!preflight?.available_social_auth_providers[provider]) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Button className={`btn-social-login ${provider}`} href={`/login/${provider}/${queryString}`}> | ||
<div className="btn-social-icon"> | ||
<div className="img" /> | ||
</div> | ||
Continue with {ProviderNames[provider]} | ||
</Button> | ||
) | ||
} | ||
|
||
export function SocialLoginButtons({ title, caption, ...props }: SocialLoginButtonsProps): JSX.Element | null { | ||
const { preflight } = useValues(preflightLogic) | ||
|
||
if ( | ||
!preflight?.available_social_auth_providers || | ||
!Object.values(preflight.available_social_auth_providers).filter((val) => !!val).length | ||
) { | ||
return null | ||
} | ||
|
||
return ( | ||
<div className="social-logins"> | ||
{title && <h3 className="l3">{title}</h3>} | ||
{caption && <div className="caption">{caption}</div>} | ||
{Object.values(SocialAuthProviders).map((provider) => ( | ||
<div key={provider}> | ||
<SocialLoginButton provider={provider} {...props} /> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} |
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,22 @@ | ||
@import '~/vars'; | ||
|
||
.starry-background { | ||
height: 100%; | ||
background: $night_sky; | ||
|
||
.stars { | ||
z-index: $z_city_background_image; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background: url('./stars.svg') repeat center center; | ||
} | ||
|
||
.children { | ||
height: 100%; | ||
position: relative; | ||
z-index: $z_city_background_content; | ||
} | ||
} |
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,17 @@ | ||
import React from 'react' | ||
import './index.scss' | ||
|
||
export function StarryBackground({ | ||
children, | ||
style, | ||
}: { | ||
children: JSX.Element | ||
style?: React.CSSProperties | ||
}): JSX.Element { | ||
return ( | ||
<div className="starry-background" style={style}> | ||
<div className="stars" /> | ||
<div className="children">{children}</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.