chore: replace search embeds with actual links

This commit is contained in:
Corbin Crutchley
2023-08-18 01:58:02 -07:00
parent 4979624ddc
commit d88d9a4af9
3 changed files with 15 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import { Chip } from "components/index";
import date from "src/icons/date.svg?raw";
import authors from "src/icons/authors.svg?raw";
import { getHrefContainerProps } from "utils/href-container-script";
import { buildSearchQuery } from "utils/search";
interface PostCardProps {
post: PostInfo;
@@ -59,7 +60,9 @@ function PostCardMeta({ post, unicornProfilePicMap }: PostCardProps) {
<ul className={style.cardList}>
{post.tags.map((tag) => (
<li>
<Chip href={`/search?q=${tag}`}>{tag}</Chip>
<Chip href={`/search?${buildSearchQuery({ filterTags: [tag] })}`}>
{tag}
</Chip>
</li>
))}
</ul>

View File

@@ -6,6 +6,7 @@ import * as data from "../../utils/data";
import { SearchInput } from "../input/input";
import { IconOnlyButton } from "../button/button";
import { Icon } from "astro-icon";
import { buildSearchQuery } from "../../utils/search";
const tagsToDisplay = [...data.tags]
.sort(() => 0.5 - Math.random())
@@ -31,7 +32,9 @@ const tagsToDisplay = [...data.tags]
{
tagsToDisplay.map((tag) => (
<li>
<Chip href={`/search?q=${tag}`}>{tag}</Chip>
<Chip href={`/search?${buildSearchQuery({ filterTags: [tag] })}`}>
{tag}
</Chip>
</li>
))
}

View File

@@ -10,6 +10,7 @@ import { translate } from "../../utils";
import { Button } from "../../components";
import styles from "./unicorn-page.module.scss";
import Achievements from "./components/achievements.astro";
import { buildSearchQuery } from "../../utils/search";
interface UnicornPageProps {
unicorn: UnicornInfo;
@@ -73,7 +74,12 @@ const showPostsToggle = posts.length > postsToDisplay.length;
<!-- TODO: Replace href with util to build search URL -->
{
showPostsToggle && (
<Button tag="a" href={"/search"}>
<Button
tag="a"
href={`/search?${buildSearchQuery({
filterAuthors: [unicorn.id],
})}`}
>
View all
</Button>
)