Skip to content

Commit

Permalink
Feature/sponsors (#25)
Browse files Browse the repository at this point in the history
* fix: added color-input to sanity config

* feat: sponsors section

* fix: sponsors section description
  • Loading branch information
njhuey authored Nov 29, 2023
1 parent 8277cd1 commit 6563d24
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/sanity/sanity.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import {colorInput} from '@sanity/color-input'
import {schemaTypes} from './schemas'

export default defineConfig({
Expand All @@ -10,7 +11,7 @@ export default defineConfig({
projectId: 'fosuyru0',
dataset: 'production',

plugins: [deskTool(), visionTool()],
plugins: [deskTool(), visionTool(), colorInput()],

schema: {
types: schemaTypes,
Expand Down
1 change: 1 addition & 0 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@radix-ui/react-toast": "^1.1.5",
"@react-three/drei": "^9.88.14",
"@react-three/fiber": "^8.15.11",
"@sanity/image-url": "^1.0.2",
"@types/three": "^0.158.2",
"clsx": "^2.0.0",
"lucide-react": "^0.292.0",
Expand Down
3 changes: 2 additions & 1 deletion apps/site/src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { About, Landing, MentorVolunteer, FAQ } from "./sections";
import { About, Landing, MentorVolunteer, FAQ, Sponsors } from "./sections";

export const revalidate = 60;

Expand All @@ -13,6 +13,7 @@ export default function Home() {
<About />
<MentorVolunteer />
<FAQ />
<Sponsors />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.title {
text-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
}
54 changes: 54 additions & 0 deletions apps/site/src/app/(home)/sections/Sponsors/Sponsors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* eslint-disable @next/next/no-img-element */
import Image from "next/image";

import { getSponsors } from "./getSponsors";
import { client } from "@/lib/sanity/client";
import imageUrlBuilder from "@sanity/image-url";
import fishingBoat from "@/assets/images/fishing-boat.png";

import styles from "./Sponsors.module.scss";

const builder = imageUrlBuilder(client);

export default async function Sponsors() {
const sponsors = await getSponsors();

return (
<section className="container py-24 md:my-16 relative items-center flex flex-col md:p-8 w-3/4 mx-auto text-center">
<h2
className={`${styles.title} my-12 font-display sm:text-[3rem] text-[#fffce2] text-4xl text-center`}
>
Sponsors
</h2>
<p className="max-w-md mb-12">
Interested in sponsoring IrvineHacks 2024? Check out our
information above to learn more about our event! For more
information, please email us at{" "}
<a
href="mailto:[email protected]"
className="hover:underline font-bold"
>
[email protected]
</a>
.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-14 items-center mb-12">
{sponsors.sponsors.map(({ _key, name, url, logo }) => (
<a
key={_key}
href={url}
target="_blank"
rel="noopener noreferrer"
>
<img
className="w-full"
src={builder.image(logo).format("webp").url()}
alt={name + " logo"}
/>
</a>
))}
</div>
<Image src={fishingBoat} alt="boat" width="400" height="400" />
</section>
);
}
21 changes: 21 additions & 0 deletions apps/site/src/app/(home)/sections/Sponsors/getSponsors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { z } from "zod";
import { cache } from "react";
import { client } from "@/lib/sanity/client";
import { SanityDocument, SanityImageReference } from "@/lib/sanity/types";

const Sponsors = SanityDocument.extend({
sponsors: z.array(
z.object({
_type: z.literal("sponsor"),
_key: z.string(),
name: z.string(),
url: z.string().url().optional(),
tier: z.union([z.literal("bronze"), z.literal("silver")]),
logo: SanityImageReference,
}),
),
});

export const getSponsors = cache(async () => {
return Sponsors.parse(await client.fetch("*[_type == 'sponsors'][0]"));
});
1 change: 1 addition & 0 deletions apps/site/src/app/(home)/sections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { default as Landing } from "./Landing/Landing";
export { default as About } from "./About/About";
export { default as MentorVolunteer } from "./MentorVolunteer/MentorVolunteer";
export { default as FAQ } from "./FAQ/FAQ";
export { default as Sponsors } from "./Sponsors/Sponsors"
Binary file added apps/site/src/assets/images/fishing-boat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 6563d24

Please sign in to comment.