-
Notifications
You must be signed in to change notification settings - Fork 0
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
enable content searching #62
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
de3b208
add scaffolding
rccsousa efca3d3
enable server actions on next-config
rccsousa fcf5f39
add fuse.js dependency
rccsousa d34e6fe
reduce content limits to avoid homepage crowding with large ammounts …
rccsousa 9b1ab00
setup fuse.js search
rccsousa 0cad042
pass pre-fetched content to SearchBar
rccsousa 3462f4f
implement micro content card to display search results
rccsousa e070317
update styling
rccsousa e33fbef
regenerate yarn.lock
rccsousa ab8ff1d
temp: add search handler
rccsousa dc869db
Merge branch 'main' of https://github.com/subvisual/content-sub into …
rccsousa 71a204c
add missing header
rccsousa 2d68d03
fix header colors
rccsousa 9c9406e
clean up
rccsousa d8d32c9
enable highlighting different content types
rccsousa e5f1b6f
update: extend rendering to other content types
rccsousa 7f71cbb
add suggestions and most recent content
rccsousa 9a94545
refresh payload config
rccsousa 9fe6028
Merge branch 'main' of https://github.com/subvisual/content-sub into …
rccsousa ba4c1a7
update conditional rendering
rccsousa 9f17f5e
remove unused files
rccsousa f5c2fca
add close icon
rccsousa e70fdcc
update global css
rccsousa 757ba57
update conditional rendering and styling
rccsousa 7bd05a5
add interfaces and fix typescript errors
rccsousa 462c43a
enable content filtering by category
rccsousa e88d111
remove async property
rccsousa 05d8d1d
introduce status-based rendering
rccsousa 479717a
improve content filtering logic
rccsousa f259b93
fix styling
rccsousa 63b46c3
rename to MobileCloseButton for clarity
rccsousa 8497fdd
add documentation
rccsousa eb871cd
linting
rccsousa 5acc84d
fix: format collection link
rccsousa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
File renamed without changes.
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
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
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
position: relative; | ||
width: 34px; | ||
height: 34px; | ||
border-radius: 50%; | ||
transition: 0.5s ease; | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,40 @@ | ||
import styles from './styles.module.css' | ||
export default function CategoryPill({ title }: { title: string }) { | ||
return <div className={styles.categoryPill}>{title}</div> | ||
"use client"; | ||
import styles from "./styles.module.css"; | ||
import { CloseIcon } from "@/app/_icons/icons"; | ||
import React, { useState } from "react"; | ||
|
||
interface CategoryPillProps { | ||
title: string, | ||
id?: string, | ||
selected?: boolean, | ||
setActiveFilter?: React.Dispatch<React.SetStateAction<boolean>> | ||
setActiveCategory?: React.Dispatch<React.SetStateAction<string>> | ||
} | ||
|
||
export default function CategoryPill({ title, id, selected = false, setActiveFilter, setActiveCategory }: CategoryPillProps) { | ||
|
||
const dynamicStyle = { | ||
"--dynamic-color": selected ? "var(--sub-blue-300)" : "var(--sub-blue-100)", | ||
} as React.CSSProperties; | ||
|
||
return ( | ||
<div id={id} className={styles.categoryPill} style={dynamicStyle}> | ||
{title} | ||
{selected && ( | ||
<button onClick={(e) => { | ||
// Stop propagation due to heavily nestes structure | ||
e.stopPropagation(); | ||
if (setActiveFilter) { | ||
setActiveFilter(false) | ||
} | ||
|
||
if (setActiveCategory) { | ||
setActiveCategory("") | ||
} | ||
}}> | ||
<CloseIcon id={id} width="16px" color="currentColor" /> | ||
</button> | ||
)} | ||
</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
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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
.featuredImage { | ||
margin: auto; | ||
border-radius: 45px; | ||
} | ||
13 changes: 13 additions & 0 deletions
13
src/app/_components/SearchBar/Components/CloseButton/index.tsx
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,13 @@ | ||
import styles from "./styles.module.css"; | ||
|
||
export default function MobileCloseButton() { | ||
return (<div className={styles.closeButton}> | ||
<p>Close</p> | ||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="20" cy="20" r="19.5" stroke="#403F4C" /> | ||
<path d="M26.4016 13.6001L13.6016 26.4001M26.4016 26.4001L13.6016 13.6001" stroke="#403F4C" stroke-linecap="round" /> | ||
</svg> | ||
|
||
</div> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/app/_components/SearchBar/Components/CloseButton/styles.module.css
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,8 @@ | ||
.closeButton { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: center; | ||
font-size: var(--size-16); | ||
gap: 16px; | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
src/app/_components/SearchBar/Components/MicroContentCard/index.tsx
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,31 @@ | ||
import Link from "next/link"; | ||
import styles from "./styles.module.css"; | ||
import FeaturedImage from "@/app/_components/FeaturedImage"; | ||
import ArchiveButton from "@/app/_components/ArchiveButton"; | ||
import { toKebabCase } from "@/app/_utilities/toKebabCase"; | ||
|
||
export default function MicroContentCard({ article }) { | ||
|
||
const contentType = article["contentType"] || article["relationTo"]; | ||
const { title, slug, featuredImage } = article["content"] || article["value"] || article; | ||
const collection = toKebabCase(contentType); | ||
|
||
|
||
return ( | ||
<div className={styles.container}> | ||
|
||
{featuredImage && ( | ||
<div className={styles.featuredImage}> | ||
<Link href={`${collection}/${slug}`}> | ||
<FeaturedImage src={featuredImage.url} /> | ||
</Link> | ||
</div> | ||
)} | ||
<div className={styles.summary}> | ||
<ArchiveButton collection={contentType} /> | ||
<Link href={`${collection}/${slug}`}><p>Read more...</p></Link> | ||
</div> | ||
</div> | ||
|
||
); | ||
} |
64 changes: 64 additions & 0 deletions
64
src/app/_components/SearchBar/Components/MicroContentCard/styles.module.css
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,64 @@ | ||
.container { | ||
display: grid; | ||
flex-direction: column; | ||
border: 1px solid var(--dark-rock-800); | ||
border-radius: 25px; | ||
padding: 20px; | ||
column-gap: 15px; | ||
width: 320px; | ||
} | ||
|
||
|
||
.container a { | ||
color: var(--sub-purple-600); | ||
font-weight: bold; | ||
font-size: var(--size-16); | ||
} | ||
|
||
.featuredImage { | ||
position: relative; | ||
width: 140px; | ||
height: 140px; | ||
align-self: center; | ||
grid-column: 1; | ||
} | ||
|
||
.summary { | ||
grid-column: 2; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
|
||
|
||
|
||
|
||
@media(min-width: 1024px){ | ||
.container { | ||
display: grid; | ||
flex-direction: column; | ||
border: 1px solid var(--dark-rock-800); | ||
border-radius: 25px; | ||
padding: 20px; | ||
column-gap: 15px; | ||
} | ||
|
||
.container a { | ||
color: var(--sub-purple-600); | ||
font-weight: bold; | ||
font-size: var(--size-16); | ||
} | ||
|
||
|
||
.featuredImage { | ||
position: relative; | ||
width: 140px; | ||
height: 140px; | ||
align-self: center; | ||
grid-column: 1; | ||
} | ||
|
||
.summary { | ||
grid-column: 2; | ||
} | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-fetching categories to feed searchbox and facilitate filtering instead of forcing async on SearchBox component
(also avoids conflicts between
use server
anduse client