Skip to content

Commit

Permalink
Fixes #30 UI addition for signup and login modal
Browse files Browse the repository at this point in the history
1. Removed clsx and making use of classNames to handle display of conditionals for tailwind
  • Loading branch information
vanamraghu committed Oct 16, 2024
1 parent 0e40032 commit 8c55ce6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/react-fontawesome": "^0.2.2",
"classnames": "^2.5.1",
"clsx": "^2.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.0"
Expand Down
22 changes: 18 additions & 4 deletions src/components/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AuthForm from "./AuthForm.jsx";
import {useState} from "react";
import clsx from "clsx";
import PropTypes from 'prop-types';
import classNames from "classnames";

const Modal = ({ setIsModalOpen }) => {
const [isSignUp, setIsSignUp] = useState(true);
Expand All @@ -10,11 +10,25 @@ const Modal = ({ setIsModalOpen }) => {
setIsSignUp(true);
setIsLogin(false);
}

const loginState = () => {
setIsLogin(true);
setIsSignUp(false);
}
const loginClassNames = classNames(
"px-20 py-2 text-lg border-r-2 border-orange-400",
{
"text-black font-semibold bg-orange-50": isSignUp,
"text-orange-500 font-semibold": !isSignUp
}
)
const signUpClassNames = classNames(
"px-20 py-2 text-lg",
{
"text-orange-500 font-semibold": isSignUp,
"text-black font-semibold bg-orange-50": !isSignUp
}
)


return (
<>
Expand All @@ -27,12 +41,12 @@ const Modal = ({ setIsModalOpen }) => {
</div>
<div className={"flex border border-orange-400 rounded-full overflow-clip"}>
<div>
<button className={clsx("px-20 py-2 text-lg border-r-2 border-orange-400", isSignUp ? "text-black font-semibold bg-orange-50" : "text-orange-500 font-semibold")}
<button className={loginClassNames}
onClick={loginState}>Login
</button>
</div>
<div>
<button className={clsx("px-20 py-2 text-lg", isSignUp ? "text-orange-500 font-semibold" : "text-black font-semibold bg-orange-50")}
<button className={signUpClassNames}
onClick={signUpState}>Signup
</button>
</div>
Expand Down

0 comments on commit 8c55ce6

Please sign in to comment.