feat: remove LogInButton.tsx

This commit is contained in:
Ruidy 2021-12-13 12:30:10 -04:00
parent b873a0b93e
commit c3df2ba713
7 changed files with 40 additions and 64 deletions

View file

@ -14,7 +14,7 @@ Free meal planner for cooks short on ideas! (like me …)
![Screenshot](docs/short_clip.gif)
### Screenshot
### Screenshots
#### Home page

View file

@ -14,4 +14,4 @@
- [ ] Use Css-in-Js
- [ ] Redirect to 404
- [x] Typescript
- [ ] strict typing
- [x] strict typing

View file

@ -38,6 +38,7 @@
"@types/node": "^14.14.37",
"@types/react": "^17.0.3",
"@types/react-router-dom": "^5.1.7",
"prettier": "^2.5.1",
"typescript": "^4.2.3"
}
}

View file

@ -1,14 +0,0 @@
import { useAuth0 } from "../utils/auth0-spa";
type Props = { color: string };
export const LogInButton = ({ color }: Props) => {
const { loginWithRedirect } = useAuth0();
const handleClick = () => loginWithRedirect({});
return (
<button className={`waves-effect waves-light btn ${color}`} onClick={handleClick}>
Log in
</button>
);
};

View file

@ -1,47 +1,40 @@
import { MouseEventHandler } from "react";
import { Link } from "react-router-dom";
import { buttonURL, links } from "../constants";
import { useAuth0 } from "../utils/auth0-spa";
import { FooterLink } from "./FooterLink";
import { LogInButton } from "./LogInButton";
import { Logo } from "./Logo";
import { LogOutButton } from "./LogOutButton";
import { RandomButton } from "./RandomButton";
type Props = { openNavClick: MouseEventHandler };
export const Navbar = ({ openNavClick }: Props) => {
const { isAuthenticated } = useAuth0();
return (
<div className="navbar-fixed">
<nav>
<div className="nav-wrapper">
<div className="container ">
<Logo />
<ul id="nav-mobile" className="right hide-on-med-and-down">
{links.map((link, i) => (
<FooterLink key={i} link={link} textColor="black" />
))}
{isAuthenticated && <FooterLink link="profile" textColor="black" />}
<li>
<RandomButton url={buttonURL} size="small" color="orange darken-2" />
</li>
<li>
{!isAuthenticated ? <LogInButton color="orange lighten-1" /> : <LogOutButton />}
</li>
</ul>
<Link
to="#"
data-target="slide-out"
className="sidenav-trigger "
onClick={openNavClick}
>
<i className="material-icons">menu</i>
</Link>
</div>
export const Navbar = ({ openNavClick }: Props) => (
<div className="navbar-fixed">
<nav>
<div className="nav-wrapper">
<div className="container ">
<Logo />
<ul id="nav-mobile" className="right hide-on-med-and-down">
{links.map((link, i) => (
<FooterLink key={i} link={link} textColor="black" />
))}
<li>
<RandomButton
url={buttonURL}
size="small"
color="orange darken-2"
/>
</li>
</ul>
<Link
to="#"
data-target="slide-out"
className="sidenav-trigger "
onClick={openNavClick}
>
<i className="material-icons">menu</i>
</Link>
</div>
</nav>
</div>
);
};
</div>
</nav>
</div>
);

View file

@ -5,8 +5,6 @@ import ChefImage from "../images/chef.svg";
import SpecialEventImage from "../images/special_event.svg";
import { useAuth0 } from "../utils/auth0-spa";
import { FooterLink } from "./FooterLink";
import { LogInButton } from "./LogInButton";
import { LogOutButton } from "./LogOutButton";
import { RandomButton } from "./RandomButton";
type Props = {
@ -35,9 +33,8 @@ export const SideNav = ({ showNav, closeNavClick }: Props) => {
left: "0",
right: "0",
bottom: "0",
backgroundColor: "rgba(0,0,0,0.5)" /* Black background with opacity */,
zIndex: 2 /* Specify a stack order in case you're using a different order for other elements */,
// cursor: "pointer" /* Add a pointer on hover */
backgroundColor: "rgba(0,0,0,0.5)",
zIndex: 2,
}}
src={SpecialEventImage}
alt="sidenav_background"
@ -65,12 +62,6 @@ export const SideNav = ({ showNav, closeNavClick }: Props) => {
<li>
<RandomButton url={buttonURL} size="small" color="orange darken-2" />
</li>
<li>
<Link to="#">
{!isAuthenticated ? <LogInButton color="orange lighten-1" /> : <LogOutButton />}
</Link>
</li>
<li>
<div className="divider" />
</li>

View file

@ -9341,6 +9341,11 @@ prepend-http@^1.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
prettier@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==
pretty-bytes@^5.3.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"