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

New navbar, footer and small fixes to landing page #34

Merged
merged 5 commits into from
Sep 19, 2024
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
Binary file added nextjs/public/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import NavBar from "@/components/NavBar";
import Navbar from "@/components/Navbar";
import { Footer } from "@/components/Footer";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -19,8 +20,9 @@ export default function RootLayout({
<html lang="en">
<body className={inter.className}>
<div className="flex min-h-screen flex-col">
<NavBar />
<Navbar />
<div className="m-5">{children}</div>
<Footer />
</div>
</body>
</html>
Expand Down
11 changes: 1 addition & 10 deletions nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//import { createClient } from "@/utils/supabase/server";
import { Container } from "@/components/ui/Container";
import { Hero } from "@/components/landing_page/Hero";
import { SectionTitle } from "@/components/landing_page/SectionTitle";
Expand All @@ -8,20 +7,12 @@ import { Faq } from "@/components/landing_page/Faq";
import { benefitData, featureData } from "@/components/landing_page/data";

export default async function Home() {
/* Subabase user for later use
const supabase = createClient();
{

const { data } = await supabase.auth.getUser();
const user = data?.user;
*/

return (
<Container>
<Hero />
<SectionTitle preTitle="Study Tutor Benefits" title=" Benefits and Features">
Intelligent Study Tutor creates personalized questions, provides instant feedback,
and answers all your study-related queries. Whether you’re preparing for exams or
and answers all your study-related questions. Whether you are preparing for exams or
just need a little extra help, Study Tutor is here to support you every step of the
way.
</SectionTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Container } from "@/components/ui/Container";

export function Footer() {
return (
<div className="relative">
<div className="relative border-t-2 border-gray-100">
<Container>
<div className="my-10 text-center text-sm text-gray-600 dark:text-gray-400">
<div className="my-2 text-center text-sm text-gray-600 dark:text-gray-400">
Copyright © {new Date().getFullYear()}
</div>
</Container>
Expand Down
66 changes: 0 additions & 66 deletions nextjs/src/components/NavBar.tsx

This file was deleted.

168 changes: 168 additions & 0 deletions nextjs/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/react";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";
import { createClient } from "@/utils/supabase/server";
import Image from "next/image";
import Link from "next/link";
import { User } from "@/types";

const navigation = [
{ name: "Home", href: "/", current: false },
{ name: "Flash cards", href: "/flashcards", current: false },
{ name: "Your studies", href: "#", current: false }
];
const userNavigation = [
{ name: "Log in", href: "/login" },
{ name: "Register", href: "/register" }
];

const userLoggedInNavigation = [{ name: "Log out", href: "/logout" }];

function classNames(...classes: string[]) {
return classes.filter(Boolean).join(" ");
}

export default async function Navbar() {
const supabase = createClient();
const { data } = await supabase.auth.getUser();
const user = data?.user as unknown as User | undefined;

return (
<>
<div className="min-h-full">
<Disclosure
as="nav"
className="fixed left-0 top-0 w-full border-b-2 border-gray-100 bg-white"
>
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div className="flex h-16 items-center justify-between">
<div className="flex items-center">
<Link href="/">
<div className="flex items-center space-x-2 text-2xl font-medium text-indigo-500 dark:text-gray-100">
<Image
alt="Study Tutor"
src="/img/logo.png"
width="32"
height="32"
className="h-8 w-8"
/>
<span>Study Tutor</span>
</div>
</Link>
<div className="hidden md:block">
<div className="ml-10 inline flex items-baseline space-x-4">
{navigation.map((item) => (
<a
key={item.name}
href={item.href}
aria-current={item.current ? "page" : undefined}
className={classNames(
item.current
? "rounded-none border-b border-gray-300 px-4 pb-1 pt-2 text-base text-indigo-500 dark:text-gray-100"
: "rounded-none px-4 py-2 text-base font-normal text-gray-800 no-underline hover:text-lg hover:text-indigo-500 focus:text-lg focus:text-indigo-500 dark:text-gray-100"
)}
>
{item.name}
</a>
))}
</div>
</div>
</div>
<div className="hidden md:block">
{user ? (
<div className="ml-auto mr-2 gap-3 lg:order-2 lg:ml-0 lg:flex">
<div className="nav__item mr-3 hidden lg:flex">
<Link
href="/logout"
className="rounded-md bg-indigo-600 px-6 py-2 text-white md:ml-5"
>
Log Out
</Link>
</div>
</div>
) : (
<div className="ml-auto mr-2 gap-3 lg:order-2 lg:ml-0 lg:flex">
<div className="nav__item mr-3 hidden lg:flex">
<Link
href="/login"
className="rounded-md bg-indigo-600 px-6 py-2 text-white md:ml-5"
>
Log In
</Link>
<Link
href="/register"
className="rounded-md bg-indigo-600 px-6 py-2 text-white md:ml-5"
>
Register
</Link>
</div>
</div>
)}
</div>
<div className="-mr-2 flex md:hidden">
{/* Mobile menu button */}
<DisclosureButton className="group relative inline-flex items-center justify-center rounded-md bg-gray-100 p-2 text-gray-400 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800">
<span className="absolute -inset-0.5" />
<span className="sr-only">Open main menu</span>
<Bars3Icon
aria-hidden="true"
className="block h-6 w-6 group-data-[open]:hidden"
/>
<XMarkIcon
aria-hidden="true"
className="hidden h-6 w-6 group-data-[open]:block"
/>
</DisclosureButton>
</div>
</div>
</div>

<DisclosurePanel className="md:hidden">
<div className="space-y-1 px-2 pb-3 pt-2 sm:px-3">
{navigation.map((item) => (
<DisclosureButton
key={item.name}
as="a"
href={item.href}
aria-current={item.current ? "page" : undefined}
className={classNames(
item.current
? "bg-gray-900 text-white"
: "text-gray-800 hover:bg-gray-700 hover:text-white",
"block rounded-md px-3 py-2 text-base font-medium"
)}
>
{item.name}
</DisclosureButton>
))}
</div>
<div className="border-t border-gray-700 pb-3 pt-4">
<div className="mt-3 space-y-1 px-2">
{user
? userLoggedInNavigation.map((item) => (
<DisclosureButton
key={item.name}
as="a"
href={item.href}
className="block rounded-md px-3 py-2 text-base font-medium text-gray-800 hover:bg-gray-700 hover:text-white"
>
{item.name}
</DisclosureButton>
))
: userNavigation.map((item) => (
<DisclosureButton
key={item.name}
as="a"
href={item.href}
className="block rounded-md px-3 py-2 text-base font-medium text-gray-800 hover:bg-gray-700 hover:text-white"
>
{item.name}
</DisclosureButton>
))}
</div>
</div>
</DisclosurePanel>
</Disclosure>
</div>
</>
);
}
Loading