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

Fix frontend issues on resources page #103

Merged
merged 10 commits into from
Oct 31, 2023
4 changes: 4 additions & 0 deletions apps/site/src/assets/icons/open-new-window.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/site/src/assets/images/api-reference-tag.png
Binary file not shown.
3 changes: 0 additions & 3 deletions apps/site/src/assets/images/clear_tape_left.svg

This file was deleted.

3 changes: 0 additions & 3 deletions apps/site/src/assets/images/clear_tape_right.svg

This file was deleted.

Binary file not shown.
Binary file removed apps/site/src/assets/images/flask_project_button.png
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions apps/site/src/assets/images/resource-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/site/src/assets/images/tape.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions apps/site/src/views/Resources/components/ApiGroup/ApiGroup.tsx

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.group {
margin-top: 50px;
width: 344px;
height: 500px;
position: relative;
padding: 1rem 0;
box-shadow: 0 6px 5px -2px rgba(gray, 0.5);
}

Expand All @@ -11,7 +11,7 @@
width: 238px;
height: 60px;
position: absolute;
top: -5%;
top: -12.5%;
}

.container {
Expand All @@ -21,18 +21,28 @@
justify-content: center;
align-items: center;
gap: 10px;
height: 450px;
height: 350px;
}

.tag {
position: absolute;
left: -5%;
bottom: 5%;
background-image: url("~@/assets/images/resource-link.svg");
samderanova marked this conversation as resolved.
Show resolved Hide resolved
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: left;
display: inline-block;
padding: 1rem;
padding-right: 3rem;
margin-left: -6px;
margin-bottom: 0.5rem;
transition:
filter 0.13s ease,
transform 0.13s ease,
filter 0.13s ease;
samderanova marked this conversation as resolved.
Show resolved Hide resolved

color: black;
samderanova marked this conversation as resolved.
Show resolved Hide resolved
text-decoration: none;
font-weight: bold;

&:hover {
samderanova marked this conversation as resolved.
Show resolved Hide resolved
transform: translateX(-5px);
tyleryy marked this conversation as resolved.
Show resolved Hide resolved
filter: drop-shadow(1px 0px 0px black) drop-shadow(-2px 0px 0px black)
samderanova marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import Image from "next/image";

import openNewWindow from "@/assets/icons/open-new-window.svg";
import styles from "./ResourceCard.module.scss";

type Tag = {
text: string;
link: string;
};

interface ResourceCardProps {
title: string;
description: JSX.Element;
stickerSrc?: string;
links: Tag[];
stickyNoteColor: string;
}

export default function ResourceCard({
title,
description,
stickerSrc,
links,
stickyNoteColor,
}: ResourceCardProps) {
return (
<div
className={styles.group}
style={{
backgroundColor: `${stickyNoteColor}`,
}}
>
<div className={styles.container + " text-center px-3"}>
<div className={styles.tape}></div>
{stickerSrc ? (
<img src={stickerSrc} alt="Resource logo" width="100" />
) : null}
samderanova marked this conversation as resolved.
Show resolved Hide resolved
<h3>{title}</h3>
{description}
</div>

{links.map(({ text, link }) => (
<a
key={link}
href={link}
target="_blank"
rel="noopener noreferrer"
className={styles.tag}
>
{text}
<div className="d-inline ms-1 vertical-align-middle">
<Image
src={openNewWindow}
width="20"
height="20"
alt="Open link in new window"
/>
</div>
</a>
))}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import imageUrlBuilder from "@sanity/image-url";

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

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

Expand All @@ -27,11 +27,11 @@ async function ApiResources() {
{resources.map(
({ _id, title, description, link, logo, stickyNoteColor }) => (
<div className={styles.column + " col"} key={_id}>
<ApiGroup
<ResourceCard
title={title}
description={<PortableText value={description} />}
stickerSrc={imageUrlBuilder(client).image(logo).url()}
tagLink={link}
links={[{ text: "API Reference", link: link }]}
samderanova marked this conversation as resolved.
Show resolved Hide resolved
stickyNoteColor={stickyNoteColor.hex}
/>
</div>
Expand Down
4 changes: 0 additions & 4 deletions apps/site/src/views/Resources/sections/ApiResources/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import google_cloud_sticker from "@/assets/icons/google-cloud-logo.png";
import twitter_sticker from "@/assets/icons/twitter-logo.png";
import spotify_sticker from "@/assets/icons/spotify-logo.png";
import api_tag from "@/assets/images/api-reference-tag.png";

const ApiResourcesList = [
{
title: "Google Cloud API",
description:
"API that allows users to access Google services such as storage access and machine-learning",
stickerSrc: google_cloud_sticker.src,
tagSrc: api_tag.src,
tagLink: "https://hack.ics.uci.edu/",
stickyNoteColor: "#FFFFA9",
},
Expand All @@ -18,7 +16,6 @@ const ApiResourcesList = [
description:
"API that retrieves data on tweets, direct messages, trends, users, and many more of Twitter's features",
stickerSrc: twitter_sticker.src,
tagSrc: api_tag.src,
tagLink: "https://hack.ics.uci.edu/",
stickyNoteColor: "#DFFFFD",
},
Expand All @@ -27,7 +24,6 @@ const ApiResourcesList = [
description:
"API that retrieves data on Spotify music, playlists, artists, users for your software applications",
stickerSrc: spotify_sticker.src,
tagSrc: api_tag.src,
tagLink: "https://hack.ics.uci.edu/",
stickyNoteColor: "#D8FFA6",
},
Expand Down
Loading
Loading