Skip to content

Commit

Permalink
43 create and style the home page (#63)
Browse files Browse the repository at this point in the history
* refactor(frontend): 🔥 replace favicon, remove unused files

* feat(frontend): ✨ add a hero component to home page

* fix(frontend): fix typo in hero

* style(frontend): 🎨 restyle navbar header to be h1 instead of button

* refactor(frontend): 💄 change darkmode icon size

* build:

* feat(frontend): 🚧 WIP: create home page and components

* feat(frontend): 🚧 WIP homepage styling and content

Added placeholder images, and text styling

* fix: 💄 fix padding and text sizing

* fix(frontend): 💄 move button and link to projects

* fix(frontend): 🐛 Fix scrollTo behaviour bugs by using gsap

* feat(frontend): ✨ add sick gsap animation to rocket

---------

Co-authored-by: Thrywyn <magnus.stromseng@gmail.com>
  • Loading branch information
2 people authored and GitHub committed Jan 31, 2024
1 parent 20eb5be commit 93ab96f
Show file tree
Hide file tree
Showing 16 changed files with 285 additions and 16 deletions.
57 changes: 57 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
"dependencies": {
"@apollo/client": "^3.9.0-alpha.5",
"@apollo/experimental-nextjs-app-support": "^0.6.0",
"@gsap/react": "^2.1.0",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-slot": "^1.0.2",
"@strapi/blocks-react-renderer": "^1.0.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"gsap": "^3.12.5",
"lucide-react": "^0.314.0",
"next": "14.1.0",
"next-themes": "^0.2.1",
Expand All @@ -37,6 +39,7 @@
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@iconify/react": "^4.1.1",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand Down
Binary file added frontend/public/images/recent-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/rocketLaunch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/satellite.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion frontend/public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion frontend/public/vercel.svg

This file was deleted.

Binary file removed frontend/src/app/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions frontend/src/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function RootLayout({
disableTransitionOnChange
>
<Navbar />
<main className="flex-grow p-5">{children}</main>
<main className="flex-grow">{children}</main>
<Footer />
</ThemeProvider>
</ApolloWrapper>
Expand Down
126 changes: 125 additions & 1 deletion frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,131 @@
"use client";
import { Button } from "@/components/ui/button";
import ColoredSection from "@/components/ui/coloredSection";
import Hero from "@/components/ui/hero";
import Image from "next/image";
import Link from "next/link";
import { gsap } from "gsap";
import { useGSAP } from "@gsap/react";

import { ScrollTrigger } from "gsap/ScrollTrigger";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";

gsap.registerPlugin(ScrollTrigger, ScrollToPlugin);

export default function Home() {
useGSAP(() => {
gsap.fromTo(
"#rocket",
{ y: 100, rotation: 45, zIndex: 1 },
{
y: -200,
x: 300,
opacity: 1,
duration: 1,
scrollTrigger: {
trigger: "#rocket",
start: "top center",
end: "bottom top",
scrub: true,
},
},
);
});

function handleClick(): void {
gsap.to(window, { duration: 1, scrollTo: "#about-us" });
}

return (
<main>
<h1>Home</h1>
<Hero
id="intro-hero"
title={"SmallSatLab"}
description={"We launch satellites 🚀"}
buttonText={"About us"}
buttonLink=""
className="min-h-[calc(100vh-72px)] flex flex-col justify-center z-10"
handleClick={handleClick}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
id="rocket"
src="/images/rocketLaunch.gif"
alt="rocket launching"
className=""
/>
</Hero>

<ColoredSection
id="about-us"
className="flex flex-col items-center py-12 px-8"
>
<div className="flex flex-col items-center text-center prose dark:prose-invert prose-img:rounded-xl">
<h1>
Empowering Space Exploration One Satellite at a Time
</h1>

<div className="relative w-[300px] h-[300px]">
<Image
alt="Satellite in orbit"
src="/images/satellite.jpg"
className="m-0 object-fill"
layout="fill"
/>
</div>
<div className="flex flex-col gap-4 items-center col-span-2 lg:col-span-2">
<div className=" self-center">
<p>
NTNU Small Satellite Lab is an initiative to
strenghten the small satellite and space related
activities at NTNU and make them more visible.
At the lab, we have a group consisting of about
ten PhD-students, two post.docs and many
bachelor- and master students every semester.
Physically, the lab consists of a concurrent
design work space as well as an well-equiped
ESD-safe area for development and testing of
electronic and mechanical parts for payloads and
platforms.
</p>
</div>
</div>
</div>
</ColoredSection>
<div className="pt-8 items-center text-center flex flex-col py-12 px-8">
<div className="prose dark:prose-invert">
<h1 className="">Projects</h1>
<p className="">
The SmallSat Lab team is part of a variety of projects,
a selection listed below. The main effort is on our two
satellites; HYPSO-1 (launched January 2022) and HYPSO-2
(expected to launch June 2024) - which you can read more
about by visiting hypso.space. Activities and research
topics include spacecraft- and systems engineering in an
university setting, development of hyperspectral camera
systems, onboard processing including autonomy and AI,
communication infrastructure for small satellites and
other satellite autonomous sensor platforms.
</p>
<Link href={"/projects"}>
<Button id="">View more</Button>
</Link>
</div>
</div>
<ColoredSection className="flex flex-col items-center py-12 px-8">
<div className="flex flex-col items-center text-center prose dark:prose-invert prose-img:rounded-xl">
<h1 className="">Most recent picture</h1>
<div className="relative w-[300px] h-[300px]">
<Image
alt="Satellite image of city"
src="/images/recent-image.jpg"
className="m-0"
layout="fill"
objectFit="cover"
/>
</div>
</div>
</ColoredSection>
</main>
);
}
2 changes: 1 addition & 1 deletion frontend/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from "next/image";

export default function Footer() {
return (
<footer className="p-4 bg-slate-700 dark:bg-slate-500 text-white flex flex-col items-center">
<footer className="p-4 bg-slate-700 text-white flex flex-col items-center">
<div className="flex flex-row items-center justify-between w-full">
<div className="flex-1 flex justify-start">
<Image
Expand Down
32 changes: 22 additions & 10 deletions frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@ export default function Navbar() {
};

return (
<nav className="flex items-center justify-between p-4 bg-slate-700 dark:bg-slate-500 text-white w-full">
<nav className="flex items-center justify-between p-4 bg-slate-700 text-white w-full">
<div className="flex-1">
<Link href="/">
<Button
variant={getButtonVariant("/")}
className="m-0 p-0 pr-4"
>
<Icon icon="mdi-light:home" className="size-10" />
Logo
</Button>
<h1 className="text-3xl font-bold flex flex-row">
<Icon
icon="twemoji:satellite"
width="36"
height="36"
className="mr-2"
/>
<span className="transition duration-300 underline decoration-transparent hover:decoration-white">
SmallSatLab
</span>
</h1>
</Link>
</div>

Expand Down Expand Up @@ -104,9 +108,17 @@ export default function Navbar() {
<div className="flex-1 flex justify-end">
<Button onClick={toggleTheme} variant={"ghost"}>
{isLightTheme ? (
<Icon icon="material-symbols:dark-mode" />
<Icon
icon="material-symbols:dark-mode"
width="32"
height="32"
/>
) : (
<Icon icon="material-symbols:light-mode" />
<Icon
icon="material-symbols:light-mode"
width="32"
height="32"
/>
)}
</Button>
</div>
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/components/ui/coloredSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import { cn } from "@/lib/utils";

const ColoredSection = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("w-full bg-muted", className)} {...props} />
));

ColoredSection.displayName = "ColoredSection"; // Add display name

export default ColoredSection;
Loading

0 comments on commit 93ab96f

Please sign in to comment.