Skip to content

Commit

Permalink
feat: basic responsivness
Browse files Browse the repository at this point in the history
  • Loading branch information
not-ani committed Aug 5, 2024
1 parent b8f1793 commit df35dce
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 8 deletions.
67 changes: 64 additions & 3 deletions apps/website/src/app/(marketing)/_components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import React from "react";
import Image from "next/image";
import Link from "next/link";
import { MenuIcon, MountainIcon } from "lucide-react";

import { Button } from "@amaxa/ui/button";
import { Sheet, SheetContent, SheetTrigger } from "@amaxa/ui/sheet";

import NavigationSection from "./nav";

export const Header = () => {
return (
<div className="flex flex-row items-center justify-evenly ">
<Image src="/amaxa.png" alt="logo" width={100} height={100} />
<div className="flex flex-row items-start justify-evenly md:items-center">
<Image
src="/amaxa.png"
alt="logo"
width={100}
height={100}
className="hidden md:block"
/>

<MobileNav />
<NavigationSection />
<div className="flex flex-row gap-4">
<div className="hidden gap-4 md:flex md:flex-row">
<Link href={"/apply"} passHref>
<button className="rounded-xl border border-black bg-black px-4 py-2 text-sm text-white transition duration-200 hover:shadow-[4px_4px_0px_0px_rgba(0,0,0)]">
Apply now
Expand All @@ -24,3 +36,52 @@ export const Header = () => {
</div>
);
};

const MobileNav = () => {
return (
<Sheet>
<SheetTrigger asChild>
<Button variant="outline" size="icon" className="block md:hidden">
<MenuIcon className="h-6 w-6" />
<span className="sr-only">Toggle navigation menu</span>
</Button>
</SheetTrigger>
<SheetContent side="left">
<Link href="#" className="mr-6 hidden lg:flex" prefetch={false}>
<MountainIcon className="h-6 w-6" />
<span className="sr-only">amaxa</span>
</Link>
<div className="grid gap-2 py-6">
<Link
href="/#projects"
className="flex w-full items-center py-2 text-lg font-semibold"
prefetch={false}
>
Explore Our Projects
</Link>
<Link
href="/team"
className="flex w-full items-center py-2 text-lg font-semibold"
prefetch={false}
>
Meet the Team
</Link>
<Link
href="stories"
className="flex w-full items-center py-2 text-lg font-semibold"
prefetch={false}
>
Read Stories
</Link>
<Link
href="/support-us"
className="flex w-full items-center py-2 text-lg font-semibold"
prefetch={false}
>
Support Us
</Link>
</div>
</SheetContent>
</Sheet>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const cardContents = [
];
export default function HowItWorks() {
return (
<motion.section className="relative">
<motion.section className="relative pb-8">
<h3 className="mt-20 text-[30px] font-bold md:text-[50px] ">
How It Works
</h3>
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/(marketing)/_components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

export default function NavigationSection() {
return (
<NavigationMenu>
<NavigationMenu className="hidden md:block">
<NavigationMenuList>
<NavigationMenuItem>
<Link href="/#projects" legacyBehavior passHref>
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/(marketing)/_components/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function Projects() {
));

return (
<div className="h-full w-full py-20">
<div className="h-full w-full overflow-x-hidden py-20">
<h2 className="font-sans text-xl font-bold text-neutral-800 dark:text-neutral-200 md:text-5xl">
Our Projects
</h2>
Expand Down
5 changes: 4 additions & 1 deletion apps/website/src/app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import { Testimonials } from "./_components/testimonials";

export default function Home() {
return (
<div>
<div className="flex flex-col">
<Hero />
<HowItWorks />
<div className="overflow-x-hidden pt-3">
<div className="absolute bottom-0 ml-[-50%] mt-[100px] h-[20px] w-[200%] rounded-t-[100%] bg-white"></div>
</div>
<Projects />
<WhatMakesUsDiffrent />
<Testimonials />
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/ui/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
const NavigationMenuItem = NavigationMenuPrimitive.Item;

const navigationMenuTriggerStyle = cva(
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-transparent px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
);

const NavigationMenuTrigger = React.forwardRef<
Expand Down
141 changes: 141 additions & 0 deletions packages/ui/src/sheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
"use client";

import type { VariantProps } from "class-variance-authority";
import * as React from "react";
import * as SheetPrimitive from "@radix-ui/react-dialog";
import { Cross2Icon } from "@radix-ui/react-icons";
import { cva } from "class-variance-authority";

import { cn } from ".";

const Sheet = SheetPrimitive.Root;

const SheetTrigger = SheetPrimitive.Trigger;

const SheetClose = SheetPrimitive.Close;

const SheetPortal = SheetPrimitive.Portal;

const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
)}
{...props}
ref={ref}
/>
));
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;

const sheetVariants = cva(
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
{
variants: {
side: {
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
bottom:
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
right:
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
},
},
defaultVariants: {
side: "right",
},
},
);

interface SheetContentProps
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
VariantProps<typeof sheetVariants> {}

const SheetContent = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Content>,
SheetContentProps
>(({ side = "right", className, children, ...props }, ref) => (
<SheetPortal>
<SheetOverlay />
<SheetPrimitive.Content
ref={ref}
className={cn(sheetVariants({ side }), className)}
{...props}
>
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
{children}
</SheetPrimitive.Content>
</SheetPortal>
));
SheetContent.displayName = SheetPrimitive.Content.displayName;

const SheetHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className,
)}
{...props}
/>
);
SheetHeader.displayName = "SheetHeader";

const SheetFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
/>
);
SheetFooter.displayName = "SheetFooter";

const SheetTitle = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold text-foreground", className)}
{...props}
/>
));
SheetTitle.displayName = SheetPrimitive.Title.displayName;

const SheetDescription = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
));
SheetDescription.displayName = SheetPrimitive.Description.displayName;

export {
Sheet,
SheetPortal,
SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
};

0 comments on commit df35dce

Please sign in to comment.