Skip to content

Commit

Permalink
fixed CustomFontAwesomeIcon result
Browse files Browse the repository at this point in the history
  • Loading branch information
danielecalda committed Sep 25, 2023
1 parent e4bd2c8 commit 9d29e08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ import { faForumbee } from "@fortawesome/free-brands-svg-icons";
import { faCalendar } from "@fortawesome/free-solid-svg-icons";
import { faFileAlt } from "@fortawesome/free-solid-svg-icons/faFileAlt";

export function CustomFontAwesomeIcon({
result,
export function CustomFontAwesomeIcon<E>({
result
}: {
result: GenericResultItem<E>;
}) {
contentTypeSet.add(result.source.document.contentType);
if (result.source.documentTypes.includes("forum")) {
const realResult = result as any
if (realResult.source.documentTypes.includes("forum")) {
return <FontAwesomeIcon icon={faForumbee} />;
}
if (result.source.documentTypes.includes("calendar")) {
if (realResult.source.documentTypes.includes("calendar")) {
return <FontAwesomeIcon icon={faCalendar} />;
}

return <FontAwesomeIcon icon={faFileAlt} />;
}

export const contentTypeSet = new Set();
6 changes: 3 additions & 3 deletions js-packages/search-frontend/src/renderer-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ export * from "./ResultLinkTwo";
export * from "./SanitizeHtml";
export * from "./SortResultList";
export * from "./WrapperContainer";
export * from "./DetailTitleExternalLink"
export * from "./ResultTitleExternalLink"
export * from "./CustomFontAwesomeIcon)"
export * from "./DetailTitleExternalLink";
export * from "./ResultTitleExternalLink";
export * from "./CustomFontAwesomeIcon";

0 comments on commit 9d29e08

Please sign in to comment.