Skip to content

Commit

Permalink
Feat: move and use built-in OAuth button #35
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed May 17, 2024
1 parent 2e30b7f commit 2144d82
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
12 changes: 9 additions & 3 deletions public/app/core/components/Login/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { t, Trans } from 'app/core/internationalization';

import { ChangePassword } from '../ForgottenPassword/ChangePassword';

import { LoginButton42Auth } from './LoginButton42Auth';
import LoginCtrl from './LoginCtrl';
import { LoginForm } from './LoginForm';
import { LoginLayout, InnerBox } from './LoginLayout';
Expand Down Expand Up @@ -67,7 +66,9 @@ export const LoginPage = () => {
<div className={styles.loginField}>
{radioValue === 'user' && (
<InnerBox>
<LoginButton42Auth />
<div className={styles.userLogin}>
<LoginServiceButtons />
</div>
</InnerBox>
)}
{radioValue === 'administrator' && !isChangingPassword && (
Expand Down Expand Up @@ -97,7 +98,7 @@ export const LoginPage = () => {
</HorizontalGroup>
</LoginForm>
)}
<LoginServiceButtons />

{!disableUserSignUp && <UserSignup />}
</InnerBox>
)}
Expand Down Expand Up @@ -128,6 +129,11 @@ const getStyles = (theme: GrafanaTheme2) => {
width: '100%',
}),

userLogin: css({
width: '100%',
alignItems: 'center',
}),

radioGroup: css({
display: 'flex',
gap: '12px',
Expand Down
40 changes: 20 additions & 20 deletions public/app/core/components/Login/LoginServiceButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,25 @@ const getServiceStyles = (theme: GrafanaTheme2) => {
};
};

const LoginDivider = () => {
const styles = useStyles2(getServiceStyles);
return (
<>
<div className={styles.divider.base}>
<div>
<div className={styles.divider.line} />
</div>
<div>
<span>{!config.disableLoginForm && <span>or</span>}</span>
</div>
<div>
<div className={styles.divider.line} />
</div>
</div>
<div className="clearfix" />
</>
);
};
// const LoginDivider = () => {
// const styles = useStyles2(getServiceStyles);
// return (
// <>
// <div className={styles.divider.base}>
// <div>
// <div className={styles.divider.line} />
// </div>
// <div>
// <span>{!config.disableLoginForm && <span>or</span>}</span>
// </div>
// <div>
// <div className={styles.divider.line} />
// </div>
// </div>
// <div className="clearfix" />
// </>
// );
// };

function getButtonStyleFor(service: LoginService, styles: ReturnType<typeof getServiceStyles>, theme: GrafanaTheme2) {
return cx(
Expand All @@ -150,7 +150,7 @@ export const LoginServiceButtons = () => {
if (hasServices) {
return (
<VerticalGroup>
<LoginDivider />
{/* <LoginDivider /> */}
{Object.entries(enabledServices).map(([key, service]) => {
const serviceName = service.name;
return (
Expand Down

0 comments on commit 2144d82

Please sign in to comment.