Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar mobile refactored design #1568

Merged
merged 7 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up
  • Loading branch information
mertbagt committed Jun 7, 2024
commit f8cabec44e364104f3f13864aa55688a2712926c
6 changes: 1 addition & 5 deletions components/DesktopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useTranslation } from "next-i18next"
import React from "react"
import { SignInWithButton, signOutAndRedirectToHome, useAuth } from "./auth"
import { Container, Dropdown, Nav, NavDropdown } from "./bootstrap"
import { useProfile } from "./db"

import {
Avatar,
Expand All @@ -25,9 +24,6 @@ export const DesktopNav: React.FC<React.PropsWithChildren<unknown>> = () => {
const { authenticated } = useAuth()
const { t } = useTranslation(["common", "auth"])

const result = useProfile()
let isOrg = result?.profile?.role === "organization"

return (
<Container fluid className={`bg-secondary d-flex py-2 sticky-top`}>
<NavbarLinkLogo />
Expand Down Expand Up @@ -81,7 +77,7 @@ export const DesktopNav: React.FC<React.PropsWithChildren<unknown>> = () => {
<div className={`align-self-center justify-content-end`}>
<Dropdown>
<Dropdown.Toggle className={`btn-secondary`}>
<Avatar isOrg={isOrg} />
<Avatar />
</Dropdown.Toggle>
<Dropdown.Menu>
<NavDropdown.Item>
Expand Down
14 changes: 5 additions & 9 deletions components/MobileNav.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useTranslation } from "next-i18next"
import React, { FC, useState } from "react"
import React, { useState } from "react"
import Image from "react-bootstrap/Image"
import styled from "styled-components"
import { SignInWithButton, signOutAndRedirectToHome, useAuth } from "./auth"
import { Col, Nav, Navbar, NavDropdown } from "./bootstrap"
import { useProfile } from "./db"
import {
Avatar,
NavbarLinkBills,
Expand All @@ -26,9 +25,9 @@ export const MobileNav: React.FC<React.PropsWithChildren<unknown>> = () => {
const BlackCollapse = styled(() => {
return (
<Navbar.Collapse id="basic-navbar-nav" className="bg-black mt-2 ps-4">
{/* while MAPLE is trying to do away with inline styling *
* both styled-components and bootstrap class have been *
* ignoring height properties for some reason */}
{/* while MAPLE is trying to do away with inline styling, *
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sadly setting specific heights aren't covered by bootstrap. Weird that styled-components aren't respecting that - not worth digging into here, but thanks for the heads up to look out for this issue in the future.

That said, why do we need to set a specific height here? Shouldn't the menu just be the height of the links list, whichever set of links we're dealing with?

* both styled-components and bootstrap classes have been *
* ignoring height properties for some reason */}
<div style={{ height: "100vh" }}>
{whichMenu == "site" ? <SiteLinks /> : <ProfileLinks />}
</div>
Expand Down Expand Up @@ -105,9 +104,6 @@ export const MobileNav: React.FC<React.PropsWithChildren<unknown>> = () => {

const closeNav = () => setIsExpanded(false)

const result = useProfile()
let isOrg = result?.profile?.role === "organization"

return (
<Navbar
bg="secondary"
Expand Down Expand Up @@ -144,7 +140,7 @@ export const MobileNav: React.FC<React.PropsWithChildren<unknown>> = () => {
{isExpanded && whichMenu == "profile" ? (
<Image src="/Union.svg" alt="x" width="35" height="35" />
) : (
<Avatar isOrg={isOrg} />
<Avatar />
)}
</Nav.Link>
</Navbar.Brand>
Expand Down
6 changes: 5 additions & 1 deletion components/NavbarComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import Image from "react-bootstrap/Image"
import { useMediaQuery } from "usehooks-ts"
import { useAuth } from "./auth"
import { Nav, NavDropdown } from "./bootstrap"
import { useProfile } from "./db"
import { NavLink } from "./Navlink"

export const Avatar = ({ isOrg }: { isOrg: boolean }) => {
export const Avatar = () => {
const result = useProfile()
let isOrg = result?.profile?.role === "organization"

return (
<>
{isOrg ? (
Expand Down