Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from narbs91/adds-index-page
Adds index page
- Loading branch information
Showing
19 changed files
with
701 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from "react"; | ||
import { chakra, Flex, HStack, Avatar } from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
import { useTranslation } from "react-i18next"; | ||
import MobileNav from "./mobile-nav"; | ||
import NavItems from "./nav-items"; | ||
import { useRouter } from "next/router"; | ||
|
||
/** | ||
* Implementation inspired from the developer dao website | ||
* | ||
* source: https://github.com/Developer-DAO/developerdao.com | ||
* */ | ||
export default function Nav() { | ||
const { t } = useTranslation(); | ||
const router = useRouter(); | ||
|
||
const isHomePage = router.pathname === "/"; | ||
const isGlossaryPage = router.pathname === "/glossary"; | ||
const isSearchPage = router.pathname === "/search"; | ||
|
||
return ( | ||
<chakra.nav | ||
borderBottom="1px solid" | ||
borderColor="#2C3539" | ||
backgroundColor="#2C3539" | ||
minWidth="100vw" | ||
> | ||
<Flex | ||
alignItems="center" | ||
justifyContent="space-between" | ||
mx="auto" | ||
maxW="7xl" | ||
py={3} | ||
px={5} | ||
> | ||
<Link href="/" passHref> | ||
<HStack | ||
as="a" | ||
title={t("glossetaTitle")} | ||
display="flex" | ||
alignItems="center" | ||
> | ||
<Avatar | ||
name="Glosseta" | ||
src="/glosseta_icon.png" | ||
alt="Glosseta logo" | ||
bg="#7a08fc" | ||
/> | ||
<chakra.span | ||
fontWeight="bold" | ||
fontSize="sm" | ||
transition="color 300ms ease-in-out" | ||
color="white" | ||
> | ||
{t("glossetaTitle")} | ||
</chakra.span> | ||
</HStack> | ||
</Link> | ||
<HStack display="flex" alignItems="center" spacing={1}> | ||
<HStack | ||
spacing={{ base: 3, sm: 10 }} | ||
display={{ base: "none", md: "inline-flex" }} | ||
> | ||
<NavItems | ||
isHomePage={isHomePage} | ||
isGlossaryPage={isGlossaryPage} | ||
isSearchPage={isSearchPage} | ||
/> | ||
</HStack> | ||
|
||
<MobileNav | ||
isHomePage={isHomePage} | ||
isGlossaryPage={isGlossaryPage} | ||
isSearchPage={isSearchPage} | ||
/> | ||
</HStack> | ||
</Flex> | ||
</chakra.nav> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import { | ||
Box, | ||
useColorModeValue, | ||
useDisclosure, | ||
VStack, | ||
IconButton, | ||
CloseButton, | ||
} from "@chakra-ui/react"; | ||
import { AiOutlineMenu } from "react-icons/ai"; | ||
import NavItems from "./nav-items"; | ||
|
||
export default function MobileNav({ | ||
isHomePage, | ||
isGlossaryPage, | ||
isSearchPage, | ||
}: any) { | ||
const bg = useColorModeValue("gray.800", "gray.800"); | ||
const { onClose, onOpen, isOpen } = useDisclosure(); | ||
|
||
return ( | ||
<Box display={{ base: "inline-flex", md: "none" }}> | ||
<IconButton | ||
display={{ base: "flex", md: "none" }} | ||
aria-label="Open menu" | ||
fontSize="20px" | ||
color="white" | ||
variant="ghost" | ||
icon={<AiOutlineMenu />} | ||
onClick={onOpen} | ||
/> | ||
|
||
<VStack | ||
pos="absolute" | ||
top={0} | ||
left={0} | ||
right={0} | ||
display={isOpen ? "flex" : "none"} | ||
flexDirection="column" | ||
pt={7} | ||
pb={7} | ||
m={0} | ||
bg={bg} | ||
spacing={3} | ||
rounded="sm" | ||
shadow="sm" | ||
zIndex="99" | ||
> | ||
<CloseButton aria-label="Close menu" onClick={onClose} color="white" /> | ||
|
||
<NavItems | ||
isHomePage={isHomePage} | ||
isGlossaryPage={isGlossaryPage} | ||
isSearchPage={isSearchPage} | ||
/> | ||
</VStack> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react"; | ||
|
||
import Link from "next/link"; | ||
import { useTranslation } from "react-i18next"; | ||
import styles from "../../../../styles/Home.module.css"; | ||
import { Button } from "@chakra-ui/react"; | ||
|
||
export default function NavItems({ | ||
isHomePage, | ||
isGlossaryPage, | ||
isSearchPage, | ||
}: any) { | ||
const { t } = useTranslation(); | ||
|
||
/** | ||
* The intent of the conditional checks is so that the respective pages link is not available to the user to click. | ||
* So if the user is on the Glossary page, they will see every nav item except the Search (i.e. Home) item. | ||
*/ | ||
return ( | ||
<> | ||
{isGlossaryPage && ( | ||
<Link href="/" passHref> | ||
<Button color="white" variant="ghost"> | ||
{t("searchButtonTitle")} | ||
<span className={styles.visuallyhidden}> | ||
{t("glossetaNavbarButtonA11yText")} | ||
</span> | ||
</Button> | ||
</Link> | ||
)} | ||
|
||
{(isHomePage || isSearchPage) && ( | ||
<Link href="/glossary" passHref> | ||
<Button color="white" variant="ghost"> | ||
{t("glossaryButton")} | ||
</Button> | ||
</Link> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Box, Text, Container, VStack, Heading, Link } from "@chakra-ui/react"; | ||
import { ExternalLinkIcon } from "@chakra-ui/icons"; | ||
import { useTranslation } from "next-i18next"; | ||
import styles from "../../../styles/Home.module.css"; | ||
|
||
export const GlossaryDataFetchError = (): JSX.Element => { | ||
const twitter_href = `https://twitter.com/intent/tweet?screen_name=Glossetadotcom`; | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<Container maxW={{ base: "sm", sm: "xl" }}> | ||
<Box | ||
width="100%" | ||
background="#2C3539" | ||
borderWidth="1px" | ||
borderColor="black" | ||
> | ||
<VStack padding={3}> | ||
<Heading | ||
as="h1" | ||
padding={2} | ||
maxWidth="50%" | ||
color="white" | ||
fontSize={{ base: "md", sm: "xl" }} | ||
isTruncated | ||
> | ||
{t("glossaryTermFetchErrorHeading")} | ||
</Heading> | ||
<Text padding={2} fontSize={{ base: "xs", sm: "md" }} color="white"> | ||
{t("glossaryTermFetchErrorText")}{" "} | ||
<Link color="aquamarine" href={twitter_href} isExternal> | ||
{t("twitter")} <ExternalLinkIcon mx="2px" /> | ||
<span className={styles.visuallyhidden}> | ||
{t("opensInANewWindow")} | ||
</span> | ||
</Link> | ||
</Text> | ||
</VStack> | ||
</Box> | ||
</Container> | ||
</> | ||
); | ||
}; | ||
|
||
export default GlossaryDataFetchError; |
Oops, something went wrong.
75f9dab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: