Skip to content

Commit 7684de2

Browse files
committed
Modal and loader component added.
1 parent 7aa3d73 commit 7684de2

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/Components/Loader/Loader.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
3+
const CircularProgress = props => (
4+
<div className={`loader ${props.className}`}>
5+
<svg className="circular" viewBox="25 25 50 50">
6+
<circle
7+
className="path"
8+
cx="50"
9+
cy="50"
10+
r="15"
11+
fill="none"
12+
strokeWidth="2"
13+
strokeMiterlimit="10"
14+
/>
15+
</svg>
16+
</div>
17+
);
18+
export default CircularProgress;

src/Components/Modals/Modal.jsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React, { useState } from "react";
2+
import { Modal, Button } from "react-bootstrap";
3+
import PropTypes from "prop-types";
4+
5+
const ModalComponent = props => {
6+
const [show, setShow] = useState(false);
7+
8+
const handleClose = () => setShow(false);
9+
const handleShow = () => setShow(true);
10+
const { heading, body } = props;
11+
return (
12+
<>
13+
<Button variant="primary" onClick={handleShow}>
14+
Launch demo modal
15+
</Button>
16+
17+
<Modal show={show} onHide={handleClose}>
18+
<Modal.Header closeButton>
19+
<Modal.Title>{heading}</Modal.Title>
20+
</Modal.Header>
21+
<Modal.Body>{body}</Modal.Body>
22+
<Modal.Footer>
23+
<Button variant="secondary" onClick={handleClose}>
24+
Close
25+
</Button>
26+
<Button variant="primary" onClick={handleClose}>
27+
Save Changes
28+
</Button>
29+
</Modal.Footer>
30+
</Modal>
31+
</>
32+
);
33+
};
34+
ModalComponent.propTypes = {
35+
heading: PropTypes.String,
36+
body: PropTypes.String
37+
};
38+
export default ModalComponent;

0 commit comments

Comments
 (0)