-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/subvisual/content-sub into …
…rs/encapsulate-hub-head-block
- Loading branch information
Showing
39 changed files
with
711 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
run-linters: | ||
name: Run linters | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install Node.js dependencies | ||
run: npm install | ||
|
||
- name: Run linters | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
.headContainer { | ||
background-color: var(--sub-purple-400); | ||
color: var(--soft-white-100); | ||
border-bottom-right-radius: 16px; | ||
border-bottom-left-radius: 16px; | ||
padding-left: 15px; | ||
padding-right: 15px; | ||
} | ||
|
||
.backButton { | ||
display: block; | ||
font-family: Colfax, sans-serif; | ||
padding-top: 40px; | ||
padding-left: 15px; | ||
padding-bottom: 40px; | ||
} | ||
|
||
|
||
.contentContainer { | ||
display: grid; | ||
grid-template-rows: 2fr; | ||
font-family: var(--colfax); | ||
padding-bottom: 40px; | ||
} | ||
|
||
.sharingAndCategories { | ||
grid-row-start: 1; | ||
} | ||
|
||
@media (min-width: 1080px) { | ||
|
||
.headContainer { | ||
width: calc(100% - 40px); | ||
margin: 0 auto; | ||
} | ||
|
||
.backButton { | ||
padding-left: 95px; | ||
color: var(--soft-white-100); | ||
} | ||
|
||
.contentContainer { | ||
width: calc(100% - 40px); | ||
margin: 20px auto; | ||
display: grid; | ||
grid-template-columns: 0.3fr 0.6fr 0.3fr; | ||
} | ||
|
||
.sharingAndCategories { | ||
justify-content: left; | ||
padding-left: 40px; | ||
grid-column: 3 / 3; | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use client' | ||
|
||
import { useEffect, useState } from 'react' | ||
|
||
import styles from './styles.module.css' | ||
|
||
export default function BlogpostChapters({ chapters }) { | ||
const [visibleChapter, setVisibleChapter] = useState(null) | ||
|
||
useEffect(() => { | ||
const observer = new IntersectionObserver( | ||
entries => { | ||
entries.forEach(entry => { | ||
if (entry.isIntersecting) { | ||
setVisibleChapter(entry.target.id) // Update state with the visible chapter's ID | ||
} | ||
}) | ||
}, | ||
{ threshold: 0.1 }, // Trigger when 10% of the element is visible | ||
) | ||
|
||
const chapters = document.querySelectorAll('[id^="chapter"]') | ||
chapters.forEach(chapter => observer.observe(chapter)) | ||
|
||
// unmount | ||
return () => { | ||
chapters.forEach(chapter => observer.unobserve(chapter)) | ||
} | ||
}, []) | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.navbar}> | ||
<p className={`outline ${styles.title}`}>CHAPTER</p> | ||
<ul> | ||
{chapters.map((chapter, i) => ( | ||
<a href={`#${chapter.id}`}> | ||
<li | ||
style={{ | ||
borderColor: | ||
visibleChapter === chapter.id | ||
? 'var(--sub-purple-400)' | ||
: 'var(--soft-white-100)', | ||
}} | ||
key={i} | ||
> | ||
{chapter.title} | ||
</li> | ||
</a> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.container { | ||
display: none; | ||
} | ||
|
||
@media(min-width: 1024px) { | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
grid-template-columns: repeat(2, 1fr); | ||
width: 100%; | ||
gap: 20px; | ||
padding: 20px 50px; | ||
} | ||
|
||
.container ul { | ||
margin-top: 20px; | ||
list-style: none; | ||
padding: 0; | ||
} | ||
|
||
.container li { | ||
border-left: 4px solid; | ||
padding: 10px 20px; | ||
} | ||
|
||
.navbar { | ||
position: sticky; | ||
top: 20px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use client' | ||
|
||
import { Blogpost } from '../../../payload/payload-types' | ||
import FeaturedImage from '../../_components/FeaturedImage' | ||
import { sanitizeAndAddChapters } from '../../_utilities/sanitizeAndAddChapters' | ||
import styles from './styles.module.css' | ||
|
||
export default function BlogpostContent({ post }: { post: Blogpost }) { | ||
const { summary, content_html, featuredImage } = post | ||
const sanitizedContent = sanitizeAndAddChapters(content_html) | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<FeaturedImage className={styles.featuredImage} src={featuredImage} /> | ||
<div className={styles.summary}>{summary}</div> | ||
<div className={styles.content} dangerouslySetInnerHTML={{ __html: sanitizedContent }} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.container { | ||
width: 100%; | ||
padding: 20px; | ||
} | ||
|
||
.featuredImage { | ||
margin: auto; | ||
border-radius: 45px; | ||
} | ||
|
||
.summary { | ||
font-size: var(--size-18); | ||
margin: 20px auto; | ||
} | ||
|
||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 20px; | ||
text-align: justify; | ||
word-wrap: break-word; | ||
white-space: normal; | ||
overflow-wrap: break-word; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.