Skip to content

Commit

Permalink
feat: added login buttons to login redirect page
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLarouche authored and Sepehr-Sobhani committed Jun 29, 2023
1 parent 8a7da2a commit deec456
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
17 changes: 13 additions & 4 deletions app/components/Layout/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,28 @@ const Navigation: React.FC<Props> = ({
const showExternalOperatorsLogin =
useShowGrowthbookFeature("external-operators");

const router = useRouter();

let rightSide = isLoggedIn ? (
<>
{userProfileComponent}
<LogoutForm />
</>
) : router.pathname === "/" ? (
isLoggedIn
) : (
<>
{userProfileComponent}
<div
id="login-buttons"
style={{
display: "flex",
"flex-direction": "row",
gap: "1.25em",
}}
>
<LoginForm />
{showExternalOperatorsLogin && <LoginForm isExternal={true} />}
</>
</div>
);
const router = useRouter();

const unauthorizedIdir = title === "Access required";

Expand Down
35 changes: 31 additions & 4 deletions app/components/Session/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,42 @@ const LoginForm: React.FC<Props> = ({ isExternal }) => {

return (
<>
<form action={loginURI} method="post">
{isExternal ? (
<Button type="submit" variant="secondary">
<form id="login-buttons" action={loginURI} method="post">
{isExternal && router.pathname.includes("login-redirect") ? (
<Button
className="loginButton externalUser"
type="submit"
variant="secondary-inverse"
>
External User Login
</Button>
) : isExternal ? (
<Button
className="loginButton externalUser"
type="submit"
variant="secondary"
>
External User Login
</Button>
) : router.pathname.includes("login-redirect") ? (
<Button
className="loginButton"
type="submit"
variant="secondary-inverse"
>
Administrator Login
</Button>
) : (
<Button type="submit">Administrator Login</Button>
<Button className="loginButton" type="submit">
Administrator Login
</Button>
)}
</form>
<style jsx>{`
#login-buttons {
margin: 0px;
}
`}</style>
</>
);
};
Expand Down
1 change: 1 addition & 0 deletions app/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function Index({ preloadedQuery }: RelayProps<{}, pagesQuery>) {
display: flex;
justify-content: center;
flex-direction: column;
gap: 1em;
}
`}
</style>
Expand Down

0 comments on commit deec456

Please sign in to comment.