Skip to content

Commit

Permalink
Added Resources title and section title component (#177)
Browse files Browse the repository at this point in the history
* Added resources title svg and changed title in Resources landing

* Created Heading Card

* Added island button svgs

* Removed island svgs

* Updated font weights for card

* Updated import order for Landing.tsx and ApiResources.tsx

* Fixed resources title and text padding for mobile

* Used relative sizes for padding instead of px for FAQ and HeadingCard

* Added visually hidden title for resources landing

* Replaced all section heading cards in resources

* Changed import order for resource sections, changed heading pixel size to rem
  • Loading branch information
IanWearsHat authored Oct 22, 2024
1 parent 68f70a3 commit 7e895de
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 62 deletions.
8 changes: 4 additions & 4 deletions apps/site/src/app/(home)/sections/FAQ/FAQ.module.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@use "zothacks-theme" as theme;
@use "bootstrap-utils" as utils;

$mobile-item-padding-y: 26px;
$mobile-item-padding-x: 32px;
$mobile-item-padding-y: 1.6rem;
$mobile-item-padding-x: 2rem;

$item-padding-y: 32px;
$item-padding-x: 48px;
$item-padding-y: 2rem;
$item-padding-x: 3rem;

.container {
position: relative;
Expand Down
3 changes: 3 additions & 0 deletions apps/site/src/assets/images/resources-bang.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions apps/site/src/assets/images/resources-title.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions apps/site/src/views/Resources/Resources.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
$container-padding: 6rem;

.resources {
h2 {
text-align: center;
}

:global {
section {
// responsive padding
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@use "zothacks-theme" as theme;
@use "bootstrap-utils" as utils;

$mobile-item-padding-y: 1.6rem;
$mobile-item-padding-x: 2rem;

$item-padding-y: 2rem;
$item-padding-x: 3rem;

$heading-font-size: 1.75rem;

.card {
background-color: theme.$white;
border: 6px solid theme.$white;
box-shadow: inset 0 0 0 6px theme.$black;
border-radius: 16px;

padding: $mobile-item-padding-y $mobile-item-padding-x;

display: flex;
align-items: center;
}

.bang {
margin-right: $mobile-item-padding-x - 0.4375;
}

.title {
font-size: $heading-font-size;
font-weight: 600;
color: theme.$light-blue;
}

.description {
margin: 0;
font-weight: 500;
}

@include utils.media-breakpoint-up(md) {
.card {
padding: $item-padding-y $item-padding-x;
}

.bang {
margin-right: $item-padding-x - 0.4375;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Image from "next/image";
import resourcesBang from "@/assets/images/resources-bang.svg";

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

interface HeadingCardProps {
title: string;
description: string;
}

export default function HeadingCard({ title, description }: HeadingCardProps) {
return (
<div className={styles.card}>
<Image
className={styles.bang}
src={resourcesBang}
alt="exclamation mark"
/>
<div>
<h2 className={styles.title}>{title}</h2>
<p className={styles.description}>{description}</p>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@
align-items: center;
}

.card {
background-image: url("~@/assets/index_cards/api-description-card.svg");
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
height: 343px;
position: relative;
display: flex;
justify-content: center;
margin-bottom: 30px;
}

.text {
font-size: 24px;
height: 60%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import { PortableText } from "@portabletext/react";
import imageUrlBuilder from "@sanity/image-url";

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

import ResourceCard from "../../components/ResourceCard/ResourceCard";
import HeadingCard from "../../components/HeadingCard/HeadingCard";
import { getResources } from "../../getResources";
import { client } from "@/lib/sanity/client";

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

async function ApiResources() {
const resources = await getResources("api");
return (
<div className="container">
{/* Card Component */}
<div className={styles.card}>
<h2 className={styles.title}>API Resources</h2>
<p className={styles.text}>
Application Programming Interface (API) are interfaces or
<HeadingCard
title="API Resources"
description="Application Programming Interface (API) are interfaces or
communication protocol that simplifies implementation and maintenance
of software. In order to access most API&apos;s, many languages use
of software. In order to access most API's, many languages use
HTTP protocol to communicate with the servers that host the API and
retrieve data.
</p>
</div>
retrieve data."
/>

<div className={styles["bottom-spacer"] + " row"}>
{/* Sticky Notes */}
{resources.map(
({ _id, title, description, link, logo, background }) => (
<div className={styles.column + " col"} key={_id}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PortableText } from "@portabletext/react";
import urlImageBuilder from "@sanity/image-url";

import ResourceCard from "../../components/ResourceCard/ResourceCard";
import HeadingCard from "../../components/HeadingCard/HeadingCard";
import { getResources } from "../../getResources";
import { client } from "@/lib/sanity/client";

Expand All @@ -11,25 +12,23 @@ async function BackendResources() {
const resources = await getResources("backend");
return (
<div className="container">
{/* Card Component */}
<div className={styles.card}>
<h2 className={styles.title}>Backend Framework Resources</h2>
<p className={styles.text}>
Backend Frameworks are a variety of middleware services used to
connect to other API and database vendors to fit your project&apos;s
needs.
</p>
</div>
<HeadingCard
title="Backend Framework Resources"
description="Backend Frameworks are a variety of middleware services used to
connect to other API and database vendors to fit your project's
needs."
/>
<div className={styles["bottom-spacer"] + " row"}>
{/* Sticky Notes */}
{resources.map(
({ _id, title, description, link, logo, background }) => (
<div className={styles.column + " col"} key={_id}>
<ResourceCard
title={title}
description={<PortableText value={description} />}
stickerSrc={urlImageBuilder(client).image(logo).url()}
islandBackground={urlImageBuilder(client).image(background).url()}
islandBackground={urlImageBuilder(client)
.image(background)
.url()}
links={[{ text: "Reference", link: link }]}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import urlImageBuilder from "@sanity/image-url";
import { PortableText } from "@portabletext/react";
import urlImageBuilder from "@sanity/image-url";

import ResourceCard from "../../components/ResourceCard/ResourceCard";
import HeadingCard from "../../components/HeadingCard/HeadingCard";
import { getResources } from "../../getResources";
import { client } from "@/lib/sanity/client";

Expand All @@ -11,14 +12,12 @@ async function FrontendResources() {
const resources = await getResources("frontend");
return (
<div className="container">
<div className={styles.card}>
<h2 className={styles.title}>Frontend Framework Resources</h2>
<p className={styles.text}>
Frontend frameworks aid in the design of user interfaces and
<HeadingCard
title="Frontend Framework Resources"
description="Frontend frameworks aid in the design of user interfaces and
experiences. Your users will interact with your services through the
frontend.
</p>
</div>
frontend."
/>
<div className={styles["bottom-spacer"] + " row"}>
{resources.map(
({ _id, title, description, link, logo, background }) => (
Expand All @@ -27,7 +26,9 @@ async function FrontendResources() {
title={title}
description={<PortableText value={description} />}
stickerSrc={urlImageBuilder(client).image(logo).url()}
islandBackground={urlImageBuilder(client).image(background).url()}
islandBackground={urlImageBuilder(client)
.image(background)
.url()}
links={[{ text: "Reference", link: link }]}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "bootstrap-utils" as utils;

.landing {
display: flex;
flex-direction: column;
Expand All @@ -8,3 +10,7 @@
margin-bottom: 5vh;
text-align: left;
}

.title {
width: 75%;
}
10 changes: 9 additions & 1 deletion apps/site/src/views/Resources/sections/Landing/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Image from "next/image";
import resourcesTitle from "@/assets/images/resources-title.svg";

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

function Landing() {
return (
<div className={styles.landing}>
<h1>Resources</h1>
<h1 className="visually-hidden">Resources</h1>
<Image
src={resourcesTitle}
className={styles.title}
alt="resources title"
/>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import urlImageBuilder from "@sanity/image-url";
import { PortableText } from "@portabletext/react";
import urlImageBuilder from "@sanity/image-url";

import ResourceCard from "../../components/ResourceCard/ResourceCard";
import HeadingCard from "../../components/HeadingCard/HeadingCard";
import { getResources } from "../../getResources";
import { client } from "@/lib/sanity/client";

Expand All @@ -11,13 +12,11 @@ async function StarterPacks() {
const resources = await getResources("starter-pack");
return (
<div className="container">
<div className={styles.card}>
<h2 className={styles.title}>Starter Pack Resources</h2>
<p className={styles.text}>
Various starter packs to start you off on your coding journeys at
ZotHacks, featuring a variety of technologies and tech stacks!
</p>
</div>
<HeadingCard
title="Starter Pack Resources"
description="Various starter packs to start you off on your coding journeys at
ZotHacks, featuring a variety of technologies and tech stacks!"
/>
<div className={styles["bottom-spacer"] + " row"}>
{resources.map(
({ _id, title, description, link, logo, background }) => (
Expand All @@ -26,7 +25,9 @@ async function StarterPacks() {
title={title}
description={<PortableText value={description} />}
stickerSrc={urlImageBuilder(client).image(logo).url()}
islandBackground={urlImageBuilder(client).image(background).url()}
islandBackground={urlImageBuilder(client)
.image(background)
.url()}
links={[{ text: "Reference", link: link }]}
/>
</div>
Expand Down

0 comments on commit 7e895de

Please sign in to comment.