From 381ceca762884abe7b2356afdc76a5af06910002 Mon Sep 17 00:00:00 2001
From: Rui Sousa <149320958+rccsousa@users.noreply.github.com>
Date: Fri, 25 Oct 2024 17:22:01 +0100
Subject: [PATCH] fix archive button rendering (#64)
Why:
- Archive button was disabled as it was breaking content rendering when
Payload and collections were updated;
How:
- by reenabling and refactoring text formating to include the updated
collections
- also fixes podcast and blogpost mobile styling
---
.../blogposts/[slug]/styles.module.css | 6 +++-
.../(pages)/podcasts/[slug]/styles.module.css | 0
.../_blocks/EpisodeContent/styles.module.css | 1 +
src/app/_blocks/EpisodeHead/index.tsx | 2 +-
.../NavBar/DropdownMenu/index.tsx | 4 +--
.../NavBar/DropdownMenu/styles.module.css | 2 +-
.../_blocks/HubContentGrid/NavBar/index.tsx | 2 --
src/app/_blocks/HubContentGrid/index.tsx | 14 +++------
.../_blocks/HubContentGrid/styles.module.css | 3 +-
src/app/_components/ArchiveButton/index.tsx | 9 +++---
src/app/_components/ContentCard/index.tsx | 31 ++++++++++---------
.../_components/PostSummary/styles.module.css | 1 -
12 files changed, 37 insertions(+), 38 deletions(-)
delete mode 100644 src/app/(pages)/podcasts/[slug]/styles.module.css
diff --git a/src/app/(pages)/blogposts/[slug]/styles.module.css b/src/app/(pages)/blogposts/[slug]/styles.module.css
index 7717e37..0f4e214 100644
--- a/src/app/(pages)/blogposts/[slug]/styles.module.css
+++ b/src/app/(pages)/blogposts/[slug]/styles.module.css
@@ -25,10 +25,14 @@
}
.sharingAndCategories {
+ display: flex;
+ flex-direction: column;
grid-row-start: 1;
+ padding: 20px;
+ gap: 20px;
}
-@media (min-width: 1080px) {
+@media (min-width: 1024px) {
.headContainer {
width: calc(100% - 40px);
diff --git a/src/app/(pages)/podcasts/[slug]/styles.module.css b/src/app/(pages)/podcasts/[slug]/styles.module.css
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/_blocks/EpisodeContent/styles.module.css b/src/app/_blocks/EpisodeContent/styles.module.css
index ae703ea..35ea725 100644
--- a/src/app/_blocks/EpisodeContent/styles.module.css
+++ b/src/app/_blocks/EpisodeContent/styles.module.css
@@ -48,6 +48,7 @@
flex-direction: column;
grid-row: 2 / 2;
padding: 16px;
+ row-gap: 20px;
}
.sharingAndCategories hr {
diff --git a/src/app/_blocks/EpisodeHead/index.tsx b/src/app/_blocks/EpisodeHead/index.tsx
index e42859f..7863542 100644
--- a/src/app/_blocks/EpisodeHead/index.tsx
+++ b/src/app/_blocks/EpisodeHead/index.tsx
@@ -27,7 +27,7 @@ export default function EpisodeHead({ episode }) {
{/* First Column */}
-
+
{title}
episode.podcastName property
diff --git a/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/index.tsx b/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/index.tsx
index 331d191..041be53 100644
--- a/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/index.tsx
+++ b/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/index.tsx
@@ -80,10 +80,10 @@ export default function DropdownMenu({
{/* TODO : Renable once pages are styled */}
{/*
handleButtonClick('CaseStudies')}>
{iconMap['CaseStudies']} Case Studies
-
+ */}
handleButtonClick('TalksAndRoundtables')}>
{iconMap['TalksAndRoundtables']} Talks & Roundtables
- */}
+
diff --git a/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/styles.module.css b/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/styles.module.css
index 9b3bee4..e7714ca 100644
--- a/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/styles.module.css
+++ b/src/app/_blocks/HubContentGrid/NavBar/DropdownMenu/styles.module.css
@@ -27,8 +27,8 @@
border-left: 2px solid var(--dark-rock-800);
background-color: white;
margin-top: -8px;
- margin-bottom: -40px;
padding-top: 6px;
+ overflow: hidden;
}
.dropdownMenuContainer::after {
diff --git a/src/app/_blocks/HubContentGrid/NavBar/index.tsx b/src/app/_blocks/HubContentGrid/NavBar/index.tsx
index 7be7e12..4f217f3 100644
--- a/src/app/_blocks/HubContentGrid/NavBar/index.tsx
+++ b/src/app/_blocks/HubContentGrid/NavBar/index.tsx
@@ -17,8 +17,6 @@ export default function ContentNavBar({
}
return (
- // todo: make whole button clickable?
-
diff --git a/src/app/_blocks/HubContentGrid/index.tsx b/src/app/_blocks/HubContentGrid/index.tsx
index fbc6d48..e831f66 100644
--- a/src/app/_blocks/HubContentGrid/index.tsx
+++ b/src/app/_blocks/HubContentGrid/index.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState } from "react";
+import React, { useState } from "react";
import ContentCard from "../../_components/ContentCard";
import { ContentTypeArrays } from "../../_interfaces/ContentTypeArrays";
@@ -16,10 +16,6 @@ const colorMap = {
TalksAndRoundtables: "var(--sub-purple-300)",
};
-interface HubContentGridProps {
- articles: ContentTypeArrays;
-}
-
export default function HubContentGrid({ content }) {
// todo: fix rendering when there is no content
@@ -30,19 +26,17 @@ export default function HubContentGrid({ content }) {
};
- const dynamicColor = {
+ const dynamicStyles = {
"--dynamic-color": colorMap[activeButton],
- };
+ } as React.CSSProperties
const filteredContent = filterContent({ articles: content, filter: activeButton });
return (
- {/*{
{JSON.stringify(filteredContent, null, 2)}
}*/}
- {/* TODO: fix dynamic color*/}
-
+
{filteredContent.map((article, i) => (
diff --git a/src/app/_blocks/HubContentGrid/styles.module.css b/src/app/_blocks/HubContentGrid/styles.module.css
index 364bddf..74f064d 100644
--- a/src/app/_blocks/HubContentGrid/styles.module.css
+++ b/src/app/_blocks/HubContentGrid/styles.module.css
@@ -6,7 +6,6 @@
margin: 40px auto;
border-bottom-right-radius: 45px;
border-bottom-left-radius: 45px;
- border-top-right-radius: 45px;
border: 1px solid var(--dark-rock-800);
border-top: none;
overflow: hidden;
@@ -36,9 +35,11 @@
}
.contentGridContainer {
+ position: relative;
border-top: 1px solid var(--dark-rock-800);
border-radius: 25px;
margin: 0 auto;
+ border-color: var(--dynamic-color);
}
}
diff --git a/src/app/_components/ArchiveButton/index.tsx b/src/app/_components/ArchiveButton/index.tsx
index 7ffda61..8665258 100644
--- a/src/app/_components/ArchiveButton/index.tsx
+++ b/src/app/_components/ArchiveButton/index.tsx
@@ -2,12 +2,13 @@ import { BlogpostIcon, CaseStudiesIcon, PodcastIcon, TalksIcon } from '@/app/_ic
const iconMap = {
blogposts:
,
- 'podcast-episodes': ,
+ 'podcasts': ,
'case-studies': ,
'talks-and-roundtables': ,
}
import styles from './styles.module.css'
+import Link from "next/link";
function formatTitle(text: string) {
return text
@@ -18,16 +19,16 @@ function formatTitle(text: string) {
}
interface ArchiveButtonProps {
- collection: 'blogposts' | 'podcast-episodes' | 'case-studies' | 'talks-and-roundtables'
+ collection: 'blogposts' | 'podcasts' | 'case-studies' | 'talks-and-roundtables'
color?: string
}
export default function ArchiveButton({ collection, color }: ArchiveButtonProps) {
return (
-
+
{iconMap[collection]} {formatTitle(collection)}
-
+
)
}
diff --git a/src/app/_components/ContentCard/index.tsx b/src/app/_components/ContentCard/index.tsx
index a15a171..4add87f 100644
--- a/src/app/_components/ContentCard/index.tsx
+++ b/src/app/_components/ContentCard/index.tsx
@@ -26,7 +26,7 @@ interface ContentSummaryProps {
const archiveMap = {
Blogposts: "blogposts",
- PodcastEpisodes: "podcast-episodes",
+ Podcasts: "podcasts",
CaseStudies: "case-studies",
TalksAndRoundtables: "talks-and-roundtables",
};
@@ -34,25 +34,25 @@ const archiveMap = {
export default function ContentCard({ contentType, content, rounded }: ContentSummaryProps) {
const { slug, title, summary, featuredImage, categories, publishedAt, authors } = content;
const borderStyle = {
- '--dynamic-border': rounded ? '45px' : ''
- }
-
- // todo: convert to a collection item property
- const readTime = estimateReadTime("herpaderpa");
+ "--dynamic-border": rounded ? "45px" : "",
+ };
+ // Given Payload type structure an error is expected as content_html only exists in Blogposts
+ // @ts-expect-error
+ const readTime = contentType === 'Blogposts' ? estimateReadTime(content.content_html) : ''
return (
// @ts-ignore
- {featuredImage && (
-
- {/* @ts-ignore */}
-
-
- )}
- {/*
*/}
+ {featuredImage && (
+
+ {/* @ts-ignore */}
+
+
+ )}
+
{title}
@@ -65,11 +65,12 @@ export default function ContentCard({ contentType, content, rounded }: ContentSu
{formatDateTime(publishedAt)}
- {contentType === "PodcastEpisodes" ? (
+ {contentType === "Podcasts" && (
1h
- ) : (
+ )}
+ {contentType === "Blogposts" && (
{readTime}
diff --git a/src/app/_components/PostSummary/styles.module.css b/src/app/_components/PostSummary/styles.module.css
index 1047635..9d6657d 100644
--- a/src/app/_components/PostSummary/styles.module.css
+++ b/src/app/_components/PostSummary/styles.module.css
@@ -1,5 +1,4 @@
.gridContainer {
- padding-bottom: 40px;
display: grid;
color: var(--dark-rock-800);
grid-template-rows: 1fr 1fr;