Skip to content
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

Style login page #34

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -32,7 +32,8 @@
"prisma": "^5.15.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.
18 changes: 15 additions & 3 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() {
kenzysoror marked this conversation as resolved.
Show resolved Hide resolved
return (
<button onClick={() => signIn('google', { callbackUrl: `/homepage` })}>
Sign In Google
</button>
<Button
variant="outline"
borderColor="blue.400"
colorScheme="gray"
width="275px"
height="45px"
color="black"
kenzysoror marked this conversation as resolved.
Show resolved Hide resolved
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" />
ChinemeremChigbo marked this conversation as resolved.
Show resolved Hide resolved
);
}
28 changes: 17 additions & 11 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
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() {
kenzysoror marked this conversation as resolved.
Show resolved Hide resolved
const session = useSession();
return (
<>
<Flex
direction="column" // stack items vertically
kenzysoror marked this conversation as resolved.
Show resolved Hide resolved
align="center" // center items horizontally
justify="center" // center items vertically
height="100vh" // make flex container take full viewport height
>
<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>
);
}
Loading