Skip to content

Commit

Permalink
Fix frontend issues on resources page (#103)
Browse files Browse the repository at this point in the history
* fix: backend description text overflow

* feat: new ResourceCard component

removed unused assets

* fix: key prop error

* fix: remove unused components

* fix: references to unused images

* refactor: short-circuit and color fixes

* Fix transformed filter glitches for webkit

- Include `translateZ(0)` when applying transform to drop shadow filter

---------

Co-authored-by: Taesung Hwang <[email protected]>
  • Loading branch information
samderanova and taesungh authored Oct 31, 2023
1 parent 3f0fc0e commit e66f4ad
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 231 deletions.
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,10 @@
@use "zothacks-theme" as theme;

.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 +13,7 @@
width: 238px;
height: 60px;
position: absolute;
top: -5%;
top: -12.5%;
}

.container {
Expand All @@ -21,20 +23,31 @@
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");
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;

&:hover {
transform: translateX(-5px);
color: theme.$black;
text-decoration: none;
font-weight: bold;

&:hover,
&:focus {
transform: translateX(-5px) translateZ(0);
filter: drop-shadow(1px 0px 0px black) drop-shadow(-2px 0px 0px black)
drop-shadow(0px 2px 0px black) drop-shadow(0px -2px 0px black);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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" />}
<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 }]}
stickyNoteColor={stickyNoteColor.hex}
/>
</div>
Expand Down
Loading

0 comments on commit e66f4ad

Please sign in to comment.