Skip to content

Commit

Permalink
Merge pull request #34 from uwblueprint/kenzy/login-page
Browse files Browse the repository at this point in the history
Style login page
  • Loading branch information
kenzysoror authored Oct 30, 2024
2 parents 6bc8ba0 + cdccf69 commit 434dab9
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 18 deletions.
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"prisma": "^5.16.0",
"react": "^18.2.0",
"react-calendar": "^5.0.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-icons": "^5.3.0"
},
"devDependencies": {
"@snaplet/copycat": "^5.0.0",
Expand Down
Binary file added public/images/sistema_logo_colour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions src/components/SignInButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
// importing from next-auth/react instead of our root's auth.ts because of Client & Server component issues.
// https://authjs.dev/getting-started/session-management/login
import { signIn } from 'next-auth/react';
import { Button } from '@chakra-ui/react';
import { FcGoogle } from 'react-icons/fc';

export function SignInButton() {
export function SignInButton(): JSX.Element {
return (
<button onClick={() => signIn('google', { callbackUrl: `/homepage` })}>
Sign In Google
</button>
<Button
variant="outline"
borderColor="blue.400"
colorScheme="gray"
width="275px"
height="45px"
color="text"
fontWeight="bold"
leftIcon={<FcGoogle fontSize="18px" />}
onClick={() => signIn('google', { callbackUrl: `/homepage` })}
>
Sign in with Google
</Button>
);
}
7 changes: 7 additions & 0 deletions src/components/SistemaLogoColour.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Image } from '@chakra-ui/react';

export function SistemaLogoColour() {
return (
<Image src="/images/sistema_logo_colour.png" alt="Sistema Logo Colour" />
);
}
25 changes: 13 additions & 12 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { SignInButton } from '../components/SignInButton';
import { SignOutButton } from '../components/SignOutButton';
import { useSession } from 'next-auth/react';
import { SistemaLogoColour } from '../components/SistemaLogoColour';
import { Box, Flex, Text } from '@chakra-ui/react';

export default function Index() {
const session = useSession();
export default function Index(): JSX.Element {
return (
<>
<Flex direction="column" align="center" justify="center" height="100vh">
<Box width="280px" height="auto" mb="5">
<SistemaLogoColour />
</Box>

<Text color="text" fontSize="small" mb="3">
Only sign in with a Sistema email.
</Text>

<SignInButton />
<br />
<SignOutButton />
<br />
<pre className="py-6 px-4 whitespace-pre-wrap break-all">
{JSON.stringify(session, null, 2)}
</pre>
</>
</Flex>
);
}

0 comments on commit 434dab9

Please sign in to comment.