-
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.
why: - in the current deployment the search bar is a placeholder and has no function which is not working as intented how: - enables content searching through filtering pre-fetched data that is pulled on the content hub homepage; - enables filtering by category by clicking on category pills; - includes latest content and highlights as recommendations while content searching is happening; For the time being [Fuse.js](https://www.fusejs.io/api/options.html) is being used as it offers a robust out-of-the-box configurable fuzzy search + weighted search functionality. Desktop Demo: https://github.com/user-attachments/assets/e6635f1f-a8c0-4351-8498-c86222c2cfa4 Mobile Demo: https://github.com/user-attachments/assets/f021fea1-01e4-4f25-b803-41752ef52577
- Loading branch information
Showing
26 changed files
with
706 additions
and
182 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
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.