diff --git a/src/components/KlinicAuthForm.jsx b/src/components/AuthForm.jsx similarity index 83% rename from src/components/KlinicAuthForm.jsx rename to src/components/AuthForm.jsx index 476956f..2d47233 100644 --- a/src/components/KlinicAuthForm.jsx +++ b/src/components/AuthForm.jsx @@ -2,13 +2,8 @@ import {Input, Variant} from "./Input.jsx"; import Button from "./Button.jsx"; import PropTypes from "prop-types"; -const KlinicAuthForm = ({ - headerText, - promptText, - actionLink, - actionLinkText, - buttonText - }) => { +const AuthForm = ({ headerText, promptText, actionLink, actionLinkText, buttonText }) => { + return (
@@ -22,7 +17,7 @@ const KlinicAuthForm = ({
-
{ e.preventDefault(); }}> @@ -53,7 +48,7 @@ const KlinicAuthForm = ({ ) } -KlinicAuthForm.propTypes = { +AuthForm.propTypes = { headerText: PropTypes.string, promptText: PropTypes.string, actionLink: PropTypes.string, @@ -61,4 +56,4 @@ KlinicAuthForm.propTypes = { buttonText: PropTypes.string.isRequired, } -export default KlinicAuthForm; +export default AuthForm; diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 3713252..9ca13da 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -1,5 +1,5 @@ import PropTypes from "prop-types"; -import { Link } from "react-router-dom"; +import {Link} from "react-router-dom"; import classNames from "classnames"; const Button = ({ @@ -43,12 +43,12 @@ const Button = ({ ) : ( ); diff --git a/src/components/Header.jsx b/src/components/Header.jsx new file mode 100644 index 0000000..755cbaf --- /dev/null +++ b/src/components/Header.jsx @@ -0,0 +1,34 @@ +import Button from "./Button.jsx"; +import "@fortawesome/fontawesome-free/css/all.min.css"; +import {useState} from "react"; +import Modal from "./Modal.jsx"; + +const Header = () => { + const [isModalOpen, setIsModalOpen] = useState(false); + const handleClick = () => { + setIsModalOpen(!isModalOpen); + } + + const handleContainer = (e) => { + if (e.target.parentElement.id === "parent-container") { + setIsModalOpen(false); + } + } + + return ( +
+
+ +
+ { + isModalOpen && ( + + ) + } +
+ ) +} + +export default Header; diff --git a/src/components/Modal.jsx b/src/components/Modal.jsx new file mode 100644 index 0000000..9885661 --- /dev/null +++ b/src/components/Modal.jsx @@ -0,0 +1,65 @@ +import AuthForm from "./AuthForm.jsx"; +import {useState} from "react"; +import clsx from "clsx"; +import PropTypes from 'prop-types'; + +const Modal = ({ setIsModalOpen }) => { + const [isSignUp, setIsSignUp] = useState(true); + const [isLogin, setIsLogin] = useState(false); + const signUpState = () => { + setIsSignUp(true); + setIsLogin(false); + } + + const loginState = () => { + setIsLogin(true); + setIsSignUp(false); + } + + return ( + <> +
+
+
+ +
+
+
+ +
+
+ +
+
+ { + isSignUp && + } + { + isLogin && + } +
+
+ + + ); +}; + +Modal.propTypes = { + setIsModalOpen: PropTypes.func.isRequired, +}; + +export default Modal; diff --git a/src/containers/KlinicAuthContainer.jsx b/src/containers/KlinicAuthContainer.jsx deleted file mode 100644 index 298bf45..0000000 --- a/src/containers/KlinicAuthContainer.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import KlinicAuthForm from "../components/KlinicAuthForm.jsx"; -import {useState} from "react"; -import clsx from "clsx"; - -const KlinicAuthContainer = () => { - const [isSignUp, setIsSignUp] = useState(true); - const signUpState = () => { - setIsSignUp(!isSignUp); - } - return ( -
-
-
- -
-
- -
-
- { - isSignUp ? - : - - } -
- ) -} - -export default KlinicAuthContainer;