-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAuthentication.tsx
More file actions
89 lines (79 loc) · 2.46 KB
/
Copy pathAuthentication.tsx
File metadata and controls
89 lines (79 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { useState, useEffect } from "react";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
import LogInPage from "../Pages/LogInPage";
import SignInPage from "../Pages/SignInPage";
import { useLocation } from "react-router-dom";
interface TabPanelProps {
children?: React.ReactNode;
index: number;
value: number;
}
function TabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && (
<Box sx={{ p: 3 }}>
<Typography component="span">{children}</Typography>
</Box>
)}
</div>
);
}
export default function Authentication() {
const location = useLocation();
const [value, setValue] = useState(0);
const handleChange = (_event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
const Fontcolor = {
color: "black",
};
useEffect(() => {
if (location.state !== null) {
setValue(location.state.authNo);
}
}, []);
return (
<section className="flex flex-col justify-center items-center h-screen">
<div className="my-5 font-bold text-center text-black text-2xl md:text-3xl">
Welcome to,<span className="text-primary">Open </span>
<span className="text-black">Community</span>
</div>
<div className="bg-white p-4 rounded-lg border-2 md:w-1/3 w-5/6 text-center flex flex-row shadow-md">
<div className="w-full mx-2 md:justify-end justify-center h-[35rem] overflow-y-auto">
<Box sx={{ width: "100%" }}>
<Box>
<Tabs
value={value}
onChange={handleChange}
aria-label="basic tabs example"
TabIndicatorProps={{
style: { backgroundColor: "purple" },
}}
>
<Tab label="Log In" style={Fontcolor} />
<Tab label="Sign Up" style={Fontcolor} />
</Tabs>
</Box>
<TabPanel value={value} index={0}>
<LogInPage />
</TabPanel>
<TabPanel value={value} index={1}>
<SignInPage />
</TabPanel>
</Box>
</div>
</div>
</section>
);
}