Skip to content

Commit

Permalink
Remove redundant code in LoginPage.tsx and RegisterPage.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-s committed May 15, 2024
1 parent a1c5e25 commit b5c6681
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 42 deletions.
46 changes: 25 additions & 21 deletions frontend/src/Security/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ export default function LoginPage(props: Props) {


return (
<>
<div className={"login-form"}>
<Typography component="div">
<TextField id="login-username" label="username" onInput={(event: React.ChangeEvent<HTMLInputElement>) => {setUsername(event.target.value)}}
placeholder={"Username"}/>
</Typography>
<Typography component="div">
<TextField id="login-password" label="password" onInput={(event: React.ChangeEvent<HTMLInputElement>) => {setPassword(event.target.value)}}
placeholder={"Password"} type={"password"}/>
</Typography>
<Button variant="contained" onClick={onLogin} disableRipple={true} sx={{
maxWidth: 100,
margin: 5,
background: "#69d1ca",
boxShadow: 0,
borderRadius: '15px'
}}>Login</Button>
<div>
<Link to="/register" className="link">☺︎ Not registered yet?</Link>
</div>
<div className={"login-form"}>
<Typography component="div">
<TextField id="login-username" label="username"
onInput={(event: React.ChangeEvent<HTMLInputElement>) => {
setUsername(event.target.value)
}}
placeholder={"Username"}/>
</Typography>
<Typography component="div">
<TextField id="login-password" label="password"
onInput={(event: React.ChangeEvent<HTMLInputElement>) => {
setPassword(event.target.value)
}}
placeholder={"Password"} type={"password"}/>
</Typography>
<Button variant="contained" onClick={onLogin} disableRipple={true} sx={{
maxWidth: 100,
margin: 5,
background: "#69d1ca",
boxShadow: 0,
borderRadius: '15px'
}}>Login</Button>
<div>
<Link to="/register" className="link">☺︎ Not registered yet?</Link>
</div>
</>
</div>
)
}
46 changes: 25 additions & 21 deletions frontend/src/Security/RegisterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,31 @@ export default function RegisterPage(props: Props) {
}

return (
<>
<div className={"register-form"}>
<Typography component="div">
<TextField id="register-username" label="username" onInput={(event: React.ChangeEvent<HTMLInputElement>) => {setUsername(event.target.value)}}
placeholder={"Username"}/>
</Typography>
<Typography component="div">
<TextField id="register-password" label="password" onInput={(event: React.ChangeEvent<HTMLInputElement>) => {setPassword(event.target.value)}}
placeholder={"Password"} type={"password"}/>
</Typography>
<Button variant="contained" onClick={onRegister} disableRipple={true} sx={{
maxWidth: 100,
margin: 5,
background: "#55a8a2",
boxShadow: 0,
borderRadius: '15px'
}}>Register</Button>
<div className="link">
☺︎ Welcome to the KoToKo!
</div>
<div className={"register-form"}>
<Typography component="div">
<TextField id="register-username" label="username"
onInput={(event: React.ChangeEvent<HTMLInputElement>) => {
setUsername(event.target.value)
}}
placeholder={"Username"}/>
</Typography>
<Typography component="div">
<TextField id="register-password" label="password"
onInput={(event: React.ChangeEvent<HTMLInputElement>) => {
setPassword(event.target.value)
}}
placeholder={"Password"} type={"password"}/>
</Typography>
<Button variant="contained" onClick={onRegister} disableRipple={true} sx={{
maxWidth: 100,
margin: 5,
background: "#55a8a2",
boxShadow: 0,
borderRadius: '15px'
}}>Register</Button>
<div className="link">
☺︎ Welcome to the KoToKo!
</div>
</>
</div>
)
}

0 comments on commit b5c6681

Please sign in to comment.