aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/views/login/index.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-09-03 18:10:02 +0800
committercrupest <crupest@outlook.com>2020-09-03 18:10:02 +0800
commitac40d9c18e2ac7b4995dac38d5da04a3ea7f1559 (patch)
treeed843d6075b8c7667f1a402dfddf3f892fba3ffa /Timeline/ClientApp/src/app/views/login/index.tsx
parentb027f7d2793999159b362041b2f697df74e4b1b9 (diff)
downloadtimeline-ac40d9c18e2ac7b4995dac38d5da04a3ea7f1559.tar.gz
timeline-ac40d9c18e2ac7b4995dac38d5da04a3ea7f1559.tar.bz2
timeline-ac40d9c18e2ac7b4995dac38d5da04a3ea7f1559.zip
Migrate to react-bootstrap.
Diffstat (limited to 'Timeline/ClientApp/src/app/views/login/index.tsx')
-rw-r--r--Timeline/ClientApp/src/app/views/login/index.tsx53
1 files changed, 24 insertions, 29 deletions
diff --git a/Timeline/ClientApp/src/app/views/login/index.tsx b/Timeline/ClientApp/src/app/views/login/index.tsx
index e53d0002..5d1e8f06 100644
--- a/Timeline/ClientApp/src/app/views/login/index.tsx
+++ b/Timeline/ClientApp/src/app/views/login/index.tsx
@@ -1,15 +1,7 @@
import React, { Fragment, useState, useEffect } from "react";
import { useHistory } from "react-router";
import { useTranslation } from "react-i18next";
-import {
- Label,
- FormGroup,
- Input,
- Form,
- FormFeedback,
- Spinner,
- Button,
-} from "reactstrap";
+import { Form, Spinner, Button } from "react-bootstrap";
import { useUser, userService } from "@/services/user";
@@ -84,9 +76,9 @@ const LoginPage: React.FC = (_) => {
<div className="container login-container mt-appbar">
<h1>{t("welcome")}</h1>
<Form>
- <FormGroup>
- <Label for="username">{t("user.username")}</Label>
- <Input
+ <Form.Group>
+ <Form.Label htmlFor="username">{t("user.username")}</Form.Label>
+ <Form.Control
id="username"
disabled={process}
onChange={(e) => {
@@ -94,15 +86,17 @@ const LoginPage: React.FC = (_) => {
setUsernameDirty(true);
}}
value={username}
- invalid={usernameDirty && username === ""}
+ isInvalid={usernameDirty && username === ""}
/>
{usernameDirty && username === "" && (
- <FormFeedback>{t("login.emptyUsername")}</FormFeedback>
+ <Form.Control.Feedback>
+ {t("login.emptyUsername")}
+ </Form.Control.Feedback>
)}
- </FormGroup>
- <FormGroup>
- <Label for="password">{t("user.password")}</Label>
- <Input
+ </Form.Group>
+ <Form.Group>
+ <Form.Label htmlFor="password">{t("user.password")}</Form.Label>
+ <Form.Control
id="password"
type="password"
disabled={process}
@@ -111,30 +105,31 @@ const LoginPage: React.FC = (_) => {
setPasswordDirty(true);
}}
value={password}
- invalid={passwordDirty && password === ""}
+ isInvalid={passwordDirty && password === ""}
/>
{passwordDirty && password === "" && (
- <FormFeedback>{t("login.emptyPassword")}</FormFeedback>
+ <Form.Control.Feedback>
+ {t("login.emptyPassword")}
+ </Form.Control.Feedback>
)}
- </FormGroup>
- <FormGroup check>
- <Input
+ </Form.Group>
+ <Form.Group>
+ <Form.Check<"input">
id="remember-me"
type="checkbox"
checked={rememberMe}
onChange={(e) => {
- const v = (e.target as HTMLInputElement).checked;
- setRememberMe(v);
+ setRememberMe(e.target.checked);
}}
+ label={t("user.rememberMe")}
/>
- <Label for="remember-me">{t("user.rememberMe")}</Label>
- </FormGroup>
+ </Form.Group>
{error ? <p className="text-error">{t(error)}</p> : null}
<div>
{process ? (
- <Spinner />
+ <Spinner animation="border" />
) : (
- <Button color="primary" onClick={onSubmit}>
+ <Button variant="primary" onClick={onSubmit}>
{t("user.login")}
</Button>
)}