Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^5.16.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.8.2",
"react-scripts": "5.0.1",
"reset-css": "^5.0.1",
Expand Down
26 changes: 26 additions & 0 deletions src/components/atoms/ModalWindow/ModalWindow.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import Modal from "react-modal";
import { withTheme } from "styled-components";

import { CloseButton, modalStyles } from "./styled";

const ModalWindow = ({ isOpen = true, setIsOpen = () => {}, children }) => {
return (
<Modal
style={{
content: { ...modalStyles.content },
overlay: { ...modalStyles.overlay },
}}
isOpen={isOpen}
shouldCloseOnOverlayClick
onRequestClose={() => setIsOpen(false)}
>
<CloseButton onClick={() => setIsOpen(false)} />
{children}
</Modal>
);
};

Modal.setAppElement("body");

export default withTheme(ModalWindow);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default ModalWindow;

1 change: 1 addition & 0 deletions src/components/atoms/ModalWindow/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./ModalWindow";
42 changes: 42 additions & 0 deletions src/components/atoms/ModalWindow/styled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import styled from "styled-components";

export const modalStyles = {
content: {
maxWidth: "520px",
minWidth: "500px",
maxHeight: "80%",
borderRadius: "5px",
top: "50%",
left: "50%",
right: "auto",
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)",
border: "1px solid #E2EAF1",
backgroundColor: "#FFFFFF",
padding: "25px 45px 25px 35px",
},
overlay: {
zIndex: 2,
backgroundColor: "rgba(0, 0, 0, 0.3)",
},
};

export const CloseButton = styled.span`
position: absolute;
top: 0.7rem;
right: 0.7rem;
color: #d6d9dc;
font-size: 0.8rem;
cursor: pointer;
user-select: none;

&::before {
display: flex;
align-items: center;
justify-content: center;
width: 1rem;
height: 1rem;
content: "✕";
}
`;
18 changes: 18 additions & 0 deletions src/components/atoms/Notifier/Notifier.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { useEffect, useContext } from "react";
import { toast, ToastContainer } from "react-toastify";
import NotifierContext from "../../../context/NotifierContext";

const Notifier = () => {
const { message, clearMessage } = useContext(NotifierContext);

useEffect(() => {
if (message) {
toast.success(message);
}
clearMessage();
}, [message]);

return <ToastContainer position="top-center" autoClose={5000} closeOnClick hideProgressBar />;
};

export default Notifier;
1 change: 1 addition & 0 deletions src/components/atoms/Notifier/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./Notifier";
2 changes: 2 additions & 0 deletions src/components/molecules/ProjectsList/ProjectsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { v4 } from "uuid";
import styled from "styled-components";

import Button from "../../atoms/Button";
import ModalWindow from "../../atoms/ModalWindow";

const mockProjects = [
{
Expand Down Expand Up @@ -45,6 +46,7 @@ const Head = styled.thead`
const ProjectsList = () => {
return (
<Wrapper>
<ModalWindow> Hello </ModalWindow>
<Table>
<Head>
<tr key={`table-header-${v4()}`}>
Expand Down
31 changes: 29 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4429,6 +4429,11 @@ execa@^6.1.0:
signal-exit "^3.0.7"
strip-final-newline "^3.0.0"

exenv@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d"
integrity sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==

exit@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
Expand Down Expand Up @@ -6359,7 +6364,7 @@ log-update@^4.0.0:
slice-ansi "^4.0.0"
wrap-ansi "^6.2.0"

loose-envify@^1.1.0, loose-envify@^1.4.0:
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -7628,7 +7633,7 @@ prompts@^2.0.1, prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@^15.8.1:
prop-types@^15.7.2, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down Expand Up @@ -7781,6 +7786,21 @@ react-is@^18.0.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-lifecycles-compat@^3.0.0:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==

react-modal@^3.16.1:
version "3.16.1"
resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.16.1.tgz#34018528fc206561b1a5467fc3beeaddafb39b2b"
integrity sha512-VStHgI3BVcGo7OXczvnJN7yT2TWHJPDXZWyI/a0ssFNhGZWsPmB8cF0z33ewDXq4VfYMO1vXgiv/g8Nj9NDyWg==
dependencies:
exenv "^1.2.0"
prop-types "^15.7.2"
react-lifecycles-compat "^3.0.0"
warning "^4.0.3"

react-refresh@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
Expand Down Expand Up @@ -9165,6 +9185,13 @@ walker@^1.0.7:
dependencies:
makeerror "1.0.12"

warning@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
dependencies:
loose-envify "^1.0.0"

watchpack@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d"
Expand Down