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

Mobile Landing Page #679

Merged
merged 10 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion packages/frontend-v2/components/Authentication/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const AuthForm: React.FC<AuthFormProps> = ({
height="100%"
direction="column"
rowGap="2xl"
mx="3xl"
mx="auto"
w="80%"
maxW="450px"
>
<Heading as="h1" size="xl">
{headingText}
Expand Down
85 changes: 83 additions & 2 deletions packages/frontend-v2/components/Header/GraduateHeaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@ import { HeaderContainer } from "./HeaderContainer";
import { Logo } from "./Logo";
import { GraduateButtonLink } from "../Link";
import { UserDropdown } from "./UserDropdown";
import { Flex, Icon, IconProps, Link as ChakraLink } from "@chakra-ui/react";
import {
Flex,
Icon,
IconProps,
Link as ChakraLink,
Menu,
MenuButton,
MenuList,
MenuItem,
IconButton,
Text,
Box,
useMediaQuery,
} from "@chakra-ui/react";
import { MetaInfoWidget } from "../MetaInfo/MetaInfo";
import { HamburgerIcon } from "@chakra-ui/icons";

export const GraduatePreAuthHeader: React.FC = () => {
return (
const [isMobile] = useMediaQuery("(max-width: 640px)");

return isMobile ? (
<MobileHeader />
) : (
<GraduateHeader
rightContent={
<GraduateButtonLink href="/login">Log In</GraduateButtonLink>
Expand Down Expand Up @@ -47,6 +65,69 @@ const GraduateHeader: React.FC<GraduateHeaderProps> = ({ rightContent }) => {
);
};

const MobileHeader: React.FC = () => {
return (
<div>
<HeaderContainer fixed>
<Logo />
<Menu>
<MenuButton
as={IconButton}
aria-label="Menu"
icon={<HamburgerIcon />}
variant="ghost"
color="primary.blue.dark.main"
_hover={{
backgroundColor: "neutral.100",
}}
_active={{
backgroundColor: "neutral.200",
}}
/>
<MenuList>
<MenuItem
icon={<FeedbackIcon />}
as="a"
href="https://forms.gle/Tg9yuhR8inkrqHdN6"
target="_blank"
>
Feedback
</MenuItem>
<MenuItem
icon={<BugIcon />}
as="a"
href="https://forms.gle/Sxg3B9js8KQ2zfJS9"
target="_blank"
>
Bug/Feature
</MenuItem>
</MenuList>
</Menu>
</HeaderContainer>

<Box
display={{ tablet: "none", base: "flex" }}
top="57px"
w="100%"
position="fixed"
justifyContent="center"
alignItems="center"
bg="primary.blue.dark.main"
h="55px"
>
<Text
textColor="white"
textAlign="center"
fontSize="md"
fontWeight="bold"
>
Open our site on desktop to get started!
</Text>
</Box>
</div>
);
};

const FeedbackIcon: React.FC<IconProps> = (props) => {
return (
<Icon
Expand Down
14 changes: 12 additions & 2 deletions packages/frontend-v2/components/Header/HeaderContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import { Flex } from "@chakra-ui/react";
import React, { PropsWithChildren } from "react";

export const HeaderContainer: React.FC<PropsWithChildren> = ({ children }) => {
interface HeaderContainerProps {
fixed?: boolean;
}

export const HeaderContainer: React.FC<
PropsWithChildren<HeaderContainerProps>
> = ({ fixed, children }) => {
return (
<Flex
position={fixed ? "fixed" : "static"}
top="0"
flexDirection="row"
alignItems="center"
justifyContent="space-between"
p="1% 1.5% 1% 1.5%"
boxShadow="0px 4px 7px lightgrey"
boxShadow={fixed ? "" : "0px 4px 7px lightgrey"}
zIndex={1}
backgroundColor="white"
w="100%"
>
{children}
</Flex>
Expand Down
5 changes: 4 additions & 1 deletion packages/frontend-v2/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Head from "next/head";
import type { AppProps } from "next/app";
import { useRouter } from "next/router";
import { ChakraProvider, Flex, Heading, Text, Image } from "@chakra-ui/react";
import { theme } from "../utils";
import "react-toastify/dist/ReactToastify.min.css";
Expand All @@ -9,9 +10,11 @@ import "@fontsource/montserrat-alternates";
import { useWindowSize } from "../hooks";

function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();
const { width } = useWindowSize();

const disableApp = width && width <= 1100;
const isLandingPage = router.asPath === "/";
const disableApp = !isLandingPage && width && width <= 1100;

return (
<>
Expand Down
Loading