|
3 | 3 |
|
4 | 4 | import React, { useState, useEffect } from 'react'; |
5 | 5 | import { signIn } from 'next-auth/react'; |
6 | | -import GithubLogin from './githublogin'; |
7 | 6 | import { Grid, GridItem } from '@patternfly/react-core/dist/dynamic/layouts/Grid'; |
8 | 7 | import { Text, TextContent } from '@patternfly/react-core/dist/dynamic/components/Text'; |
9 | 8 | import { Form, FormGroup } from '@patternfly/react-core/dist/dynamic/components/Form'; |
10 | 9 | import { TextInput } from '@patternfly/react-core/dist/dynamic/components/TextInput'; |
11 | 10 | import { Button } from '@patternfly/react-core/dist/dynamic/components/Button'; |
12 | 11 | import { HelperText, HelperTextItem } from '@patternfly/react-core/dist/dynamic/components/HelperText'; |
| 12 | +import GithubIcon from '@patternfly/react-icons/dist/dynamic/icons/github-icon'; |
13 | 13 | import './githublogin.css'; |
14 | 14 |
|
15 | 15 | const Login: React.FunctionComponent = () => { |
@@ -49,6 +49,10 @@ const Login: React.FunctionComponent = () => { |
49 | 49 | setPassword(value); |
50 | 50 | }; |
51 | 51 |
|
| 52 | + const handleGitHubLogin = () => { |
| 53 | + signIn('github', { callbackUrl: '/' }); |
| 54 | + }; |
| 55 | + |
52 | 56 | const loginForm = ( |
53 | 57 | <Form onSubmit={handleLogin}> |
54 | 58 | <FormGroup label="Username" fieldId="username" className="login-label"> |
@@ -85,12 +89,24 @@ const Login: React.FunctionComponent = () => { |
85 | 89 | <Grid hasGutter span={12}> |
86 | 90 | <GridItem span={6} className="login-container"> |
87 | 91 | <TextContent> |
88 | | - <Text className="sign-in-text">Login locally with admin username and password</Text> |
| 92 | + <Text className="sign-in-text">Login locally with a username and password or via Github OAuth</Text> |
89 | 93 | </TextContent> |
90 | 94 | <TextContent> |
91 | 95 | <Text className="description-text">Join the novel, community-based movement to create truly open-source LLMs</Text> |
92 | 96 | </TextContent> |
93 | | - <div className="login-container">{loginForm}</div> |
| 97 | + <div className="login-container"> |
| 98 | + <Button |
| 99 | + variant="primary" |
| 100 | + icon={<GithubIcon />} |
| 101 | + iconPosition="left" |
| 102 | + size="lg" |
| 103 | + style={{ backgroundColor: 'black', marginBottom: '1rem' }} |
| 104 | + onClick={handleGitHubLogin} |
| 105 | + > |
| 106 | + Sign in with GitHub |
| 107 | + </Button> |
| 108 | + {loginForm} |
| 109 | + </div> |
94 | 110 | <TextContent> |
95 | 111 | <Text className="urls-text"> |
96 | 112 | <a href="https://github.com/instructlab/" style={{ color: 'white', textDecoration: 'underline' }} target="_blank"> |
@@ -128,7 +144,13 @@ const Login: React.FunctionComponent = () => { |
128 | 144 | </div> |
129 | 145 | ); |
130 | 146 |
|
131 | | - return isProd ? <GithubLogin /> : devModeContent; |
| 147 | + return isProd ? ( |
| 148 | + <Button variant="primary" icon={<GithubIcon />} iconPosition="left" onClick={handleGitHubLogin}> |
| 149 | + Sign in with GitHub |
| 150 | + </Button> |
| 151 | + ) : ( |
| 152 | + devModeContent |
| 153 | + ); |
132 | 154 | }; |
133 | 155 |
|
134 | 156 | export default Login; |
0 commit comments