Skip to content

Commit

Permalink
fix archive button rendering
Browse files Browse the repository at this point in the history
- also fixes podcast and blogpost mobile styling
  • Loading branch information
rccsousa committed Oct 25, 2024
1 parent ceebb96 commit 65578c8
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
6 changes: 5 additions & 1 deletion src/app/(pages)/blogposts/[slug]/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Empty file.
1 change: 1 addition & 0 deletions src/app/_blocks/EpisodeContent/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
flex-direction: column;
grid-row: 2 / 2;
padding: 16px;
row-gap: 20px;
}

.sharingAndCategories hr {
Expand Down
12 changes: 3 additions & 9 deletions src/app/_blocks/HubContentGrid/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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

Expand All @@ -32,17 +28,15 @@ export default function HubContentGrid({ content }) {

const dynamicColor = {
"--dynamic-color": colorMap[activeButton],
};
} as React.CSSProperties

const filteredContent = filterContent({ articles: content, filter: activeButton });


return (
<div>
{/*{<pre>{JSON.stringify(filteredContent, null, 2)}</pre>}*/}
<ContentNavBar activeButton={activeButton} onActiveButtonChange={handleActiveButtonChange} />
{/* TODO: fix dynamic color*/}
<div className={styles.contentGridContainer}>
<div className={styles.contentGridContainer} style={dynamicColor}>
<div className={styles.contentGrid}>
{filteredContent.map((article, i) => (
<div className={styles.contentCard}>
Expand Down
2 changes: 2 additions & 0 deletions src/app/_blocks/HubContentGrid/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
}

.contentGridContainer {
position: relative;
border-top: 1px solid var(--dark-rock-800);
border-radius: 25px;
margin: 0 auto;
border-color: var(--dynamic-color);
}

}
4 changes: 2 additions & 2 deletions src/app/_components/ArchiveButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BlogpostIcon, CaseStudiesIcon, PodcastIcon, TalksIcon } from '@/app/_ic

const iconMap = {
blogposts: <BlogpostIcon width={'20'} color={"currentColor"}/>,
'podcast-episodes': <PodcastIcon width={'20'} color={"currentColor"}/>,
'podcasts': <PodcastIcon width={'20'} color={"currentColor"}/>,
'case-studies': <CaseStudiesIcon width={'20'} color={"currentColor"}/>,
'talks-and-roundtables': <TalksIcon width={'20'} color={"currentColor"}/>,
}
Expand All @@ -18,7 +18,7 @@ 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
}

Expand Down
28 changes: 14 additions & 14 deletions src/app/_components/ContentCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,32 @@ interface ContentSummaryProps {

const archiveMap = {
Blogposts: "blogposts",
PodcastEpisodes: "podcast-episodes",
Podcasts: "podcasts",
CaseStudies: "case-studies",
TalksAndRoundtables: "talks-and-roundtables",
};

export default function ContentCard({ contentType, content, rounded }: ContentSummaryProps) {
const { slug, title, summary, featuredImage, categories, publishedAt, authors } = content;
const borderStyle = {
'--dynamic-border': rounded ? '45px' : ''
}
"--dynamic-border": rounded ? "45px" : "",
};

// todo: convert to a collection item property
const readTime = estimateReadTime("herpaderpa");

const readTime = contentType === 'Blogposts' ? estimateReadTime(content.content_html) : ''

return (
// @ts-ignore
<div className={styles.contentCard} style={borderStyle}>
<div className={styles.contentMetaContainer}>
<Link href={`/${toKebabCase(contentType)}/${slug}`}>
{featuredImage && (
<div className={styles.imageContainer}>
{/* @ts-ignore */}
<FeaturedImage src={featuredImage.url} />
</div>
)}
{/*<ArchiveButton collection={archiveMap[contentType]} />*/}
{featuredImage && (
<div className={styles.imageContainer}>
{/* @ts-ignore */}
<FeaturedImage src={featuredImage.url} />
</div>
)}
<ArchiveButton collection={archiveMap[contentType]} />

<h6>{title} </h6>

Expand All @@ -65,11 +64,12 @@ export default function ContentCard({ contentType, content, rounded }: ContentSu

<div className={styles.dateAndDuration}>
{formatDateTime(publishedAt)}
{contentType === "PodcastEpisodes" ? (
{contentType === "Podcasts" && (
<span>
<HeadphonesIcon width={"20"} /> 1h
</span>
) : (
)}
{contentType === "Blogposts" && (
<span>
<SpectaclesIcon width={"20"} />
{readTime}
Expand Down
1 change: 0 additions & 1 deletion src/app/_components/PostSummary/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.gridContainer {
padding-bottom: 40px;
display: grid;
color: var(--dark-rock-800);
grid-template-rows: 1fr 1fr;
Expand Down
2 changes: 1 addition & 1 deletion src/app/_utilities/estimateReadTime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function estimateReadTime(text: string): string {
export function estimateReadTime(text: string | null): string {
const WPM = 250
const wordCount = text.split(/\s+/).length
const readTimeMinutes = Math.ceil(wordCount / WPM)
Expand Down

0 comments on commit 65578c8

Please sign in to comment.