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

[DEV-026] Navbar #45

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions frontend/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Spacer,
useColorMode,
useColorModeValue,
LightMode,
} from "@chakra-ui/react";
import React from "react";
import { FaMoon, FaSun } from "react-icons/fa";
Expand All @@ -16,17 +17,22 @@ export const Navbar = (): JSX.Element => {
const SwitchIcon = useColorModeValue(FaMoon, FaSun);
const nextMode = useColorModeValue("dark", "light");

const textColor = useColorModeValue("white", "white");
const boxBg = useColorModeValue("#343A40", "#343A40");
const buttonBg = useColorModeValue("#2D9CDB", "#2D9CDB");
const iconColor = useColorModeValue("#ECC94B", "light");

Copy link
Member

Choose a reason for hiding this comment

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

Nice fix for this! we will probably need to implement a custom colorScheme so we can use the LightMode DarkMode components properly, but that can be done on a later date

return (
<Flex w="100%" m="2" mb="4">
<Box m="2">
<Flex w="101%" mb="4" bg={boxBg} boxShadow="lg">
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Since this component is used outside of the main landmark, we need to provide a semantic landmark HTML element as the wrapper rather than it being a div, can we convert this to use a nav?

Suggested change
<Flex w="101%" mb="4" bg={boxBg} boxShadow="lg">
<Flex w="101%" mb="4" bg={boxBg} boxShadow="lg" as="nav">

For reference: https://www.w3.org/TR/wai-aria-practices/examples/landmarks/HTML5.html

<Box m="4" color={textColor}>
<Heading size="md">Dialog</Heading>
</Box>
<Spacer />
<Box>
<Button m="1" size="sm">
<Box m="1">
<Button m="1" size="sm" bg={buttonBg} color={textColor}>
Sign Up
</Button>
<Button m="1" size="sm">
<Button m="1" size="sm" bg={buttonBg} color={textColor}>
Login
</Button>
Copy link
Member

@AipioxTechson AipioxTechson Jan 9, 2021

Choose a reason for hiding this comment

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

Can we i18n Sign up and Login?

<IconButton
Expand All @@ -37,7 +43,7 @@ export const Navbar = (): JSX.Element => {
color="current"
margin="1"
onClick={toggleColorMode}
icon={<SwitchIcon />}
icon={<SwitchIcon color={iconColor} />}
/>
</Box>
</Flex>
Expand Down