Skip to content

refactor: Make login headline one line and add auth method section #1922

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

Merged
merged 3 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 48 additions & 7 deletions site/src/components/SignInForm/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import FormHelperText from "@material-ui/core/FormHelperText"
import Link from "@material-ui/core/Link"
import { makeStyles } from "@material-ui/core/styles"
import TextField from "@material-ui/core/TextField"
import GitHubIcon from "@material-ui/icons/GitHub"
import { FormikContextType, useFormik } from "formik"
import { FC } from "react"
import * as Yup from "yup"
Expand Down Expand Up @@ -49,6 +50,29 @@ const useStyles = makeStyles((theme) => ({
submitBtn: {
marginTop: theme.spacing(2),
},
buttonIcon: {
width: 14,
height: 14,
},
divider: {
paddingTop: theme.spacing(3),
paddingBottom: theme.spacing(3),
display: "flex",
alignItems: "center",
gap: theme.spacing(2),
},
dividerLine: {
width: "100%",
height: 1,
backgroundColor: theme.palette.divider,
},
dividerLabel: {
flexShrink: 0,
color: theme.palette.text.secondary,
textTransform: "uppercase",
fontSize: 12,
letterSpacing: 1,
},
}))

export interface SignInFormProps {
Expand Down Expand Up @@ -119,13 +143,30 @@ export const SignInForm: FC<SignInFormProps> = ({
</div>
</form>
{authMethods?.github && (
<div className={styles.submitBtn}>
<Link href={`/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent(redirectTo)}`}>
<Button disabled={isLoading} fullWidth type="submit" variant="contained">
{Language.githubSignIn}
</Button>
</Link>
</div>
<>
<div className={styles.divider}>
<div className={styles.dividerLine} />
<div className={styles.dividerLabel}>Or</div>
<div className={styles.dividerLine} />
</div>

<div>
<Link
underline="none"
href={`/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent(redirectTo)}`}
>
<Button
startIcon={<GitHubIcon className={styles.buttonIcon} />}
disabled={isLoading}
fullWidth
type="submit"
variant="contained"
>
{Language.githubSignIn}
</Button>
</Link>
</div>
</>
)}
</>
)
Expand Down
6 changes: 1 addition & 5 deletions site/src/components/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ export const Welcome: FC = () => {
<CoderIcon className={styles.logo} />
</div>
<Typography className={styles.title} variant="h1">
<>
Welcome to
<br />
Coder
</>
Welcome to <strong>Coder</strong>
</Typography>
</div>
)
Expand Down