Skip to content

Commit

Permalink
Update mobile navbar, push chat bubble up on sm screen
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgodfrey committed Nov 8, 2023
1 parent a78a1ce commit a9cc2e5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
5 changes: 0 additions & 5 deletions my-app/src/components/chatbot/DialogflowChatWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ const DialogflowChatWidget = () => {
df-messenger-chat-bubble:hover {
--df-messenger-chat-bubble-background: ${dfMessengerColors.primaryColorHover};
}
@media (min-width: 768px) {
df-messenger {
bottom: 16px;
}
}
`}
</style>
);
Expand Down
34 changes: 16 additions & 18 deletions my-app/src/components/navbar/MobileNavbar.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import Link from "next/link";
// import { useSession } from 'next-auth/react';
import { useSession } from 'next-auth/react';

// TODO: use "active" class to highlight current page
// TODO: update links
// TODO switch to logout instead of dashboard if logged in?
const MobileNavbar = () => {
const { data: session, status } = useSession();
return (
<div className="btm-nav md:hidden">
<Link href="/home">
<button>
<span className="btm-nav-label">Home</span>
</button>
<Link href="/home" className="hover:brightness-125 hover:bg-accent/10 transition-all">
<span className="btm-nav-label">Home</span>
</Link>
<Link href="/report">
<button>
<span className="btm-nav-label">Report</span>
</button>
<Link href="/report-form" className="hover:brightness-125 hover:bg-accent/10 transition-all">
<span className="btm-nav-label">Report</span>
</Link>
<Link href="/data">
<button>
<span className="btm-nav-label">Data</span>
</button>
<Link href="/data-insights" className="hover:brightness-125 hover:bg-accent/10 transition-all">
<span className="btm-nav-label">Data</span>
</Link>
<Link href="/login">
<button>
{session
? <Link href="/dashboard" className="hover:brightness-125 hover:bg-accent/10 transition-all">
Dashboard
</Link>
: <Link href="/auth/credentials-signin">
<span className="btm-nav-label">Login</span>
</button>
</Link>
</Link>
}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import Link from "next/link";
import { useEffect, useState } from "react";

const Navbar = () => {
const SideNavbar = () => {
const { data: session, status } = useSession();
const [orgName, setOrgName] = useState("");

Expand Down Expand Up @@ -168,7 +168,7 @@ const Navbar = () => {
<div className="drawer hidden md:block lg:hidden">
<input id="my-drawer-3" type="checkbox" className="drawer-toggle" />
<div className="drawer-content flex flex-col">
{/* Navbar */}
{/* SideNavbar */}
<div className="w-full navbar">
<div className="flex-none lg:hidden">
<label
Expand Down Expand Up @@ -206,4 +206,4 @@ const Navbar = () => {
);
};

export default Navbar;
export default SideNavbar;
6 changes: 3 additions & 3 deletions my-app/src/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Navbar from "@/components/Navbar";
import SideNavbar from "@/components/navbar/SideNavbar";
import MobileNavbar from "@/components/navbar/MobileNavbar";
import { SessionProvider } from "next-auth/react";
import { ToastContainer } from "react-toastify";
Expand Down Expand Up @@ -34,13 +34,13 @@ const App = ({ Component, pageProps: { session, ...pageProps } }) => {
<>
<SessionProvider session={session}>
<div className="flex md:flex-col lg:flex-row min-h-screen">
<Navbar />
<SideNavbar />
<div className="flex-1">
<Component {...pageProps} />
</div>
<MobileNavbar />
<ToastContainer />
<div id="chatContainer" className={`fixed ${ scrollDirection === "down" ? "-bottom-24" : "bottom-0"} right-4 h-20 transition-all duration-500`}>
<div id="chatContainer" className={`fixed ${ scrollDirection === "down" ? "-bottom-24" : "md:bottom-0 bottom-14"} right-4 h-20 transition-all duration-500`}>
<DialogflowChatWidget/>
</div>
</div>
Expand Down

0 comments on commit a9cc2e5

Please sign in to comment.