Skip to content

Commit

Permalink
Startups page (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
csaye authored Sep 8, 2023
1 parent c7e7405 commit 480c817
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 6 deletions.
52 changes: 52 additions & 0 deletions components/DirectoryLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useState, useEffect } from "react";
import supabase from "../utils/supabaseClient";
import StartupTile from "./startups/StartupTile";
import { Startup } from "../utils/types";

type LayoutProps = {
title: string;
description: string;
link: string;
};

const DirectoryLayout = (props: LayoutProps) => {
const { title, description: directoryDescription, link } = props;

Check warning on line 13 in components/DirectoryLayout.tsx

View workflow job for this annotation

GitHub Actions / ci

'link' is assigned a value but never used. Allowed unused vars must match /^_/u

const [startups, setStartups] = useState<Startup[] | null>(null);

useEffect(() => {
const fetchStartups = async () => {
const { data } = await supabase.from("startups").select();
setStartups(data);
};
fetchStartups();
}, []);

return (
<div className="w-full p-4 md:p-8 flex flex-col items-center bg-gray-50">
<div className="max-w-screen-2xl relative w-full">
<div className=" flex flex-col items-center max-w-screen-2xl w-full static">
<div className="w-full rounded-2xl p-16 bg-[url('/landing.jpg')]">
<h1 className="font-bold text-white text-3xl mb-6">{title}</h1>
<h3 className="font-regular text-white text-2xl mb-9">
{directoryDescription}
</h3>
{/* <a href={link} target="_blank" rel="noreferrer">
<p className="underline text-white hover:text-slate-500">
{" "}
Register a Startup{" "}
</p>
</a> */}
</div>
</div>
</div>
<div className="w-full max-w-screen-2xl mt-8 grid gap-8 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 pt-4">
{startups?.map((startup) => (
<StartupTile startup={startup} />
))}
</div>
</div>
);
};

export default DirectoryLayout;
11 changes: 10 additions & 1 deletion components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const NAVIGATION = [
href: "https://v1network.substack.com/",
right: false,
},
{
name: "Startups",
href: "/startups",
right: false,
},
{
name: "Dashboard",
href: "/dashboard",
Expand Down Expand Up @@ -142,7 +147,11 @@ export default function NavbarBuilder() {
}
px-3 py-2 rounded-md text-sm font-medium ${
// eslint-disable-next-line no-nested-ternary, prettier/prettier
inSafari ? !user ? "relative top-nav-nouser" : "relative top-nav-user" : ""
inSafari
? !user
? "relative top-nav-nouser"
: "relative top-nav-user"
: ""
}
${item?.login && !user ? "hidden" : ""}
${item?.noauth && user ? "hidden" : ""}
Expand Down
135 changes: 135 additions & 0 deletions components/startups/StartupTile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import React, { Fragment, useState } from "react";
import {
InformationCircleIcon,
ExternalLinkIcon,
} from "@heroicons/react/outline";
import { Dialog, Transition } from "@headlessui/react";
import { Startup } from "../../utils/types";

export default function StartupTile({ startup }: { startup: Startup }) {
const { name, description, logo, website } = startup;
const [dialogOpen, setDialogOpen] = useState(false);

return (
<>
<div
className="flex flex-col bg-white font-bold p-6 leading-none text-gray-800 uppercase rounded-lg shadow-lg duration-100 border border-stone-300 cursor-pointer"
onClick={() => setDialogOpen(true)}
>
<img src={logo} className="w-1/2 mx-auto rounded-lg" alt="logo" />

<div className="mt-6 mx-auto text-center">
<h1 className="normal-case text-xl font-semibold leading-6">
{name}
</h1>
</div>

<p
style={{
height: "60px",
overflow: "hidden",
textOverflow: "ellipsis",
}}
className="normal-case text-base font-normal leading-5 tracking-normal text-left mt-3 text-gray-500"
>
{description}
</p>

<div className="flex mt-4 justify-between items-center">
<button
type="button"
style={{
backgroundColor: "#212936",
width: "calc(50% - 6px)",
}}
className="rounded-lg p-2 font-inter text-sm leading-5 tracking-normal text-left text-gray-200 flex justify-center"
>
<a
href={website}
target="_blank"
rel="noopener noreferrer"
className="flex flex-row m-auto items-center gap-1"
>
<InformationCircleIcon className=" inline-block h-5 w-5" />
<p className="inline-block">See More</p>
</a>
</button>

<button
type="button"
style={{ width: "calc(50% - 6px)" }}
className="rounded-lg p-2 font-inter text-sm leading-5 tracking-normal text-left text-gray-600 bg-gray-300 flex justify-center"
>
<a
href={website}
className="flex flex-row m-auto items-center gap-1"
>
<ExternalLinkIcon className=" inline-block h-5 w-5" />
<p className="inline-block">Website</p>
</a>
</button>
</div>
</div>
<Transition appear show={dialogOpen} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
onClose={() => setDialogOpen(false)}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>

<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-xl transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
<div className="flex flex-col gap-y-4">
<div className="flex gap-x-8">
<img src={logo} className="w-48 rounded-lg" alt="logo" />
<div className="flex flex-col gap-y-4">
<h1 className="text-4xl font-bold text-gray-900">
{name}
</h1>
<a
href={website}
target="_blank"
rel="noopener noreferrer"
className="flex flex-row items-center gap-1 text-gray-500"
>
<ExternalLinkIcon className=" inline-block h-5 w-5" />
<p className="inline-block underline">Website</p>
</a>
</div>
</div>
<div className="mt-2">
<p className="text-sm text-gray-500">{description}</p>
</div>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
</>
);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint:fix": "eslint --fix '**/*.{js,jsx,ts,tsx}' && npm run check-types"
},
"dependencies": {
"@headlessui/react": "^1.2.0",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^1.0.1",
"@supabase/supabase-js": "^1.29.0",
"@svgr/webpack": "^6.2.1",
Expand Down
18 changes: 18 additions & 0 deletions pages/startups.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NextPage } from "next";
import Head from "../components/Head";
import NavbarBuilder from "../components/NavBar";
import DirectoryLayout from "../components/DirectoryLayout";

const Startups: NextPage = () => (
<>
<Head title="Startups" />
<NavbarBuilder />
<DirectoryLayout
title="Startup Directory"
description="This is the V1 Startup Directory"
link="https://www.google.com"
/>
</>
);

export default Startups;
13 changes: 13 additions & 0 deletions utils/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export type Startup = {
created_at: string;
description: string;
id: number;
industries: string[];
logo: string;
name: string;
roles: string[];
size: number;
stage: string;
tech: string[];
website: string;
};
15 changes: 11 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,12 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@headlessui/react@^1.2.0":
version "1.5.0"
resolved "https://registry.npmjs.org/@headlessui/react/-/react-1.5.0.tgz"
integrity sha512-aaRnYxBb3MU2FNJf3Ut9RMTUqqU3as0aI1lQhgo2n9Fa67wRu14iOGqx93xB+uMNVfNwZ5B3y/Ndm7qZGuFeMQ==
"@headlessui/react@^1.7.17":
version "1.7.17"
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.17.tgz#a0ec23af21b527c030967245fd99776aa7352bc6"
integrity sha512-4am+tzvkqDSSgiwrsEpGWqgGo9dz8qU5M3znCkC4PgkpY4HcCZzEDEvozltGGGHIKl9jbXbZPSH5TWn4sWJdow==
dependencies:
client-only "^0.0.1"

"@heroicons/react@^1.0.1":
version "1.0.6"
Expand Down Expand Up @@ -1963,6 +1965,11 @@ chokidar@^3.5.3:
optionalDependencies:
fsevents "~2.3.2"

client-only@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"
integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==

color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz"
Expand Down

0 comments on commit 480c817

Please sign in to comment.