update admin for bs5

- more consistent use of react-bootstrap
- reusable MainContainer, MainCol for consistent layout
This commit is contained in:
Min RK
2024-04-15 13:31:35 +02:00
parent a50ed507fe
commit 8820d5c028
11 changed files with 426 additions and 459 deletions

View File

@@ -1,8 +1,9 @@
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate } from "react-router-dom";
import { Button } from "react-bootstrap";
import { Button, Col } from "react-bootstrap";
import PropTypes from "prop-types";
import ErrorAlert from "../../util/error";
const AddUser = (props) => {
const [users, setUsers] = useState([]),
@@ -28,26 +29,9 @@ const AddUser = (props) => {
return (
<>
<div className="container" data-testid="container">
{errorAlert != null ? (
<div className="row">
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
<div className="alert alert-danger">
{errorAlert}
<button
type="button"
className="close"
onClick={() => setErrorAlert(null)}
>
<span>&times;</span>
</button>
</div>
</div>
</div>
) : (
<></>
)}
<ErrorAlert errorAlert={errorAlert} setErrorAlert={setErrorAlert} />
<div className="row">
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
<Col md={{ span: 10, offset: 1 }} lg={{ span: 8, offset: 2 }}>
<div className="card">
<div className="card-header">
<h4>Add Users</h4>
@@ -90,10 +74,10 @@ const AddUser = (props) => {
</Button>
</Link>
<span> </span>
<button
<Button
id="submit"
data-testid="submit"
className="btn btn-primary"
variant="primary"
onClick={() => {
addUsers(users, admin)
.then((data) =>
@@ -114,10 +98,10 @@ const AddUser = (props) => {
}}
>
Add Users
</button>
</Button>
</div>
</div>
</div>
</Col>
</div>
</div>
</>