diff --git a/package.json b/package.json index 12e8dc6..df2992e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/atoms/ModalWindow/ModalWindow.jsx b/src/components/atoms/ModalWindow/ModalWindow.jsx new file mode 100644 index 0000000..e7f9511 --- /dev/null +++ b/src/components/atoms/ModalWindow/ModalWindow.jsx @@ -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 ( + setIsOpen(false)} + > + setIsOpen(false)} /> + {children} + + ); +}; + +Modal.setAppElement("body"); + +export default withTheme(ModalWindow); diff --git a/src/components/atoms/ModalWindow/index.js b/src/components/atoms/ModalWindow/index.js new file mode 100644 index 0000000..c0b7dc1 --- /dev/null +++ b/src/components/atoms/ModalWindow/index.js @@ -0,0 +1 @@ +export { default } from "./ModalWindow"; diff --git a/src/components/atoms/ModalWindow/styled.js b/src/components/atoms/ModalWindow/styled.js new file mode 100644 index 0000000..568951f --- /dev/null +++ b/src/components/atoms/ModalWindow/styled.js @@ -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: "✕"; + } +`; diff --git a/src/components/atoms/Notifier/Notifier.jsx b/src/components/atoms/Notifier/Notifier.jsx new file mode 100644 index 0000000..3bee679 --- /dev/null +++ b/src/components/atoms/Notifier/Notifier.jsx @@ -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 ; +}; + +export default Notifier; diff --git a/src/components/atoms/Notifier/index.js b/src/components/atoms/Notifier/index.js new file mode 100644 index 0000000..8c53ab4 --- /dev/null +++ b/src/components/atoms/Notifier/index.js @@ -0,0 +1 @@ +export { default } from "./Notifier"; diff --git a/src/components/molecules/ProjectsList/ProjectsList.jsx b/src/components/molecules/ProjectsList/ProjectsList.jsx index 3692dcf..6acc535 100644 --- a/src/components/molecules/ProjectsList/ProjectsList.jsx +++ b/src/components/molecules/ProjectsList/ProjectsList.jsx @@ -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 = [ { @@ -45,6 +46,7 @@ const Head = styled.thead` const ProjectsList = () => { return ( + Hello diff --git a/yarn.lock b/yarn.lock index 53fadad..a568c97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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== @@ -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== @@ -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" @@ -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"