Implement new LoginModal in HeaderMenu

This commit is contained in:
Justin Edmund 2022-02-28 16:40:48 -08:00
parent 1c7e602464
commit f3d2ff9662
4 changed files with 4 additions and 18 deletions

View file

@ -12,7 +12,7 @@ interface Props {
const Fieldset = React.forwardRef<HTMLInputElement, Props>(function fieldSet(props, ref) { const Fieldset = React.forwardRef<HTMLInputElement, Props>(function fieldSet(props, ref) {
const fieldType = (['password', 'confirm_password'].includes(props.fieldName)) ? 'password' : 'text' const fieldType = (['password', 'confirm_password'].includes(props.fieldName)) ? 'password' : 'text'
return ( return (
<fieldset className="Fieldset"> <fieldset className="Fieldset">
<input <input

View file

@ -19,10 +19,6 @@ interface Props {
} }
const HeaderMenu = (props: Props) => { const HeaderMenu = (props: Props) => {
const { open: signupOpen, openModal: openSignupModal, closeModal: closeSignupModal } = useSignupModal()
const { open: loginOpen, openModal: openLoginModal, closeModal: closeLoginModal } = useLoginModal()
const { open: aboutOpen, openModal: openAboutModal, closeModal: closeAboutModal } = useAboutModal()
function authItems() { function authItems() {
return ( return (
<nav> <nav>
@ -74,18 +70,9 @@ const HeaderMenu = (props: Props) => {
</li> </li>
</div> </div>
<div className="MenuGroup"> <div className="MenuGroup">
<li className="MenuItem" onClick={openLoginModal}> <LoginModal />
<span>Log in</span>
</li>
{loginOpen ? (
<LoginModal
close={closeLoginModal}
/>
) : null}
<SignupModal /> <SignupModal />
</div> </div>
</ul> </ul>
) )
} }

View file

@ -12,6 +12,7 @@
&.btn-disabled { &.btn-disabled {
background: $grey-90; background: $grey-90;
color: $grey-70; color: $grey-70;
cursor: not-allowed;
} }
&:not(.btn-disabled) { &:not(.btn-disabled) {

View file

@ -88,7 +88,7 @@ const SignupModal = (props: Props) => {
const fieldName = event.target.name const fieldName = event.target.name
const value = event.target.value const value = event.target.value
if (value.length >= 3) { if (value.length >= 3) {
api.check(fieldName, value) api.check(fieldName, value)
.then((response) => { .then((response) => {
processNameCheck(fieldName, value, response.data.available) processNameCheck(fieldName, value, response.data.available)
@ -220,8 +220,6 @@ const SignupModal = (props: Props) => {
</Dialog.Close> </Dialog.Close>
</div> </div>
<form className="form" onSubmit={register}> <form className="form" onSubmit={register}>
<Fieldset <Fieldset
fieldName="username" fieldName="username"