Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
fix: undefined nav home button (#540)
Browse files Browse the repository at this point in the history
* fix: undefined nav home button
  • Loading branch information
ntheile authored Aug 24, 2023
1 parent c52c940 commit 45cf0fe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
20 changes: 18 additions & 2 deletions components/Layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Props = {
}

const AppLayout = ({ children, username }: Props) => {
const router = useRouter()
const { memo } = useRouter().query
const [openSideBar, setOpenSideBar] = React.useState<boolean>(false)
const [copied, setCopied] = React.useState<boolean>(false)
Expand All @@ -35,12 +36,27 @@ const AppLayout = ({ children, username }: Props) => {
setOpenSideBar(false)
}

const navigateHome = () => {
let pathname = "/"
if (username) pathname = `/${username}`
router.push(
{
pathname,
},
undefined,
{ shallow: true },
)
setTimeout(function () {
router.reload() // Force a reload after a short delay to allow location href to update
}, 200)
}

return (
<div className={`${openSideBar && styles.container_bg} ${styles.container}`}>
<nav className={styles.nav_bar}>
<a href={`/${username}`} style={{ cursor: "pointer" }}>
<button className={styles.nav_home} onClick={navigateHome}>
<Image src="/icons/blink-logo-icon.svg" alt="logo" width="50" height="50" />
</a>
</button>
<div onClick={() => setOpenSideBar(!openSideBar)} className={styles.hamburger}>
<span className={`${openSideBar && styles.toggle}`}></span>
<span className={`${openSideBar && styles.toggle}`}></span>
Expand Down
6 changes: 6 additions & 0 deletions components/Layouts/app-layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
text-transform: uppercase;
}

.nav_home {
cursor: "pointer";
border: 0;
background-color: rgba(255, 0, 0, 0);
}

.lightning_addr {
padding-left: 1rem;
}
Expand Down

0 comments on commit 45cf0fe

Please sign in to comment.