Skip to content

Commit 9ff5899

Browse files
authored
Merge pull request #17 from WillSams/style/further-tweak-styles
Add loading component
2 parents 6772eba + 4073d16 commit 9ff5899

File tree

7 files changed

+27
-124
lines changed

7 files changed

+27
-124
lines changed

frontend/public/css/application.css

Lines changed: 5 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/public/img/loading.gif

79.7 KB
Loading

frontend/public/js/jquery-3.7.1.slim.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/screens/home/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ const HomeComponent = ({
3535
<Tab.Container defaultActiveKey="reservations">
3636
<Row className="nav nav-tabs ml-4">
3737
<Nav className="bg-dark">
38-
<Col lg={7}>
38+
<Col lg={6}>
3939
<Nav.Item>
4040
<Nav.Link eventKey="reservations">Reservations</Nav.Link>
4141
</Nav.Item>
4242
</Col>
43-
<Col lg={5}>
43+
<Col lg={6}>
4444
<Nav.Item>
4545
<Nav.Link eventKey="about">About</Nav.Link>
4646
</Nav.Item>

frontend/src/screens/home/tabs/DefaultTab.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
import React from 'react';
22
import { Button } from 'react-bootstrap';
33
import { Link } from 'react-router-dom';
4+
import { useSelector } from 'react-redux';
45

56
import { default as utils } from '@/shared/utils';
7+
import { Loading } from '@/shared/components';
68

79
const DefaultTab = ({
810
reservations = [],
911
actions = { cancelReservation: () => {} },
1012
}) => {
1113
const { cancelReservation } = actions;
14+
const loading = useSelector((state) => state?.site?.home?.loading);
15+
1216
return (
1317
<div data-name="reservations-tab">
1418
<div className="col-lg-12 bg-dark mx-auto">
1519
<h3>Reservations</h3>
1620
<div className="container flex-column">
17-
{reservations.length > 0 ? (
21+
{loading && reservations.length === 0 && <Loading />}
22+
{!loading && reservations.length === 0 && (
23+
<div>No reservations exist.</div>
24+
)}
25+
{reservations.length > 0 && (
1826
<table className="table bg-light">
1927
<thead>
2028
<tr>
@@ -65,8 +73,6 @@ const DefaultTab = ({
6573
))}
6674
</tbody>
6775
</table>
68-
) : (
69-
<div>No reservations exist.</div>
7076
)}
7177
</div>
7278
</div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import { Image } from 'react-bootstrap';
3+
4+
const Loading = ({ width = 99, height = 99 }) => {
5+
return <Image width={width} height={height} src="/img/loading.gif" />;
6+
};
7+
8+
export default Loading;

frontend/src/shared/components/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as AlertModal } from './AlertModal';
22
export { default as App } from './App';
33
export { default as ConfirmationModal } from './ConfirmationModal';
44
export { default as InvalidRoute } from './InvalidRoute';
5+
export { default as Loading } from './Loading';

0 commit comments

Comments
 (0)