Skip to content

Commit

Permalink
Fixes and updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
sherakama committed Oct 16, 2024
1 parent 2fb3dfa commit a7dfa08
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/page-types/searchPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const SearchPage = (props) => {
>
<Configure
hitsPerPage={itemsPerPageInt}
attributesToSnippet={['body:50']}
attributesToHighlight={['body:400']}
highlightPreTag="<b>"
highlightPostTag="</b>"
/>
Expand Down
14 changes: 9 additions & 5 deletions src/components/search/Hits/SearchResultAlumniEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Heading } from '../../simple/Heading';
import HeroIcon from '../../simple/heroIcon';
import { utmParams } from '../../../utilities/utmParams';
import { checkParams } from '../../../utilities/checkParams';
import { decodeHtmlEntities } from '../../../utilities/decodeHtmlEntities';

/**
* Alumni Event {Hit}
Expand All @@ -22,7 +23,7 @@ const SearchResultAlumniEvent = ({ result }) => {
domain,
url,
title,
_snippetResult,
_highlightResult,
start,
end,
timeZone,
Expand Down Expand Up @@ -111,15 +112,18 @@ const SearchResultAlumniEvent = ({ result }) => {
</p>

{/* eslint-disable-next-line no-underscore-dangle */}
{_snippetResult?.body.value && (
{_highlightResult?.body.value && (
<p
className="su-card-paragraph su-leading-snug su-mb-0"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
// eslint-disable-next-line no-underscore-dangle
__html: sanitize(_snippetResult.body.value, {
allowedTags: ['br', 'mark', 'i', 'b', 'em', 'strong'],
}),
__html: sanitize(
decodeHtmlEntities(_highlightResult.body.value),
{
allowedTags: ['br', 'mark', 'i', 'b', 'em', 'strong'],
}
),
}}
/>
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/search/Hits/SearchResultDefault.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SearchResultDefault = ({ result }) => {
const location = useLocation();
const utms = utmParams(location.search);

const { objectID, domain, url, fileType, title, image, _snippetResult } =
const { objectID, domain, url, fileType, title, image, _highlightResult } =
result;

return (
Expand Down Expand Up @@ -70,14 +70,14 @@ const SearchResultDefault = ({ result }) => {
</a>
</Heading>
{/* eslint-disable-next-line no-underscore-dangle */}
{_snippetResult?.body.value && (
{_highlightResult?.body.value && (
<p
className="su-card-paragraph su-leading-snug su-mb-0"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
// eslint-disable-next-line no-underscore-dangle
__html: sanitize(
decodeHtmlEntities(_snippetResult.body.value),
decodeHtmlEntities(_highlightResult.body.value),
{
decodeEntities: false,
allowedTags: ['mark', 'i', 'b', 'em', 'strong', 'br'],
Expand Down
6 changes: 2 additions & 4 deletions src/utilities/synchronizedEvents.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DateTime } from 'luxon';
import TurndownService from 'turndown';
import markdownConverter from 'storyblok-markdown-richtext';
import { markdownToRichtext } from 'storyblok-markdown-richtext';
import { luxonDate } from './dates';
import { slugify } from './slugify';
import regions from './regions.json';
Expand Down Expand Up @@ -269,9 +269,7 @@ export const googleRowToStoryContent = (data, source) => {
}
: null;
const description = descriptionRaw
? markdownConverter.markdownToRichtext(
turndownService.turndown(descriptionRaw)
)
? markdownToRichtext(turndownService.turndown(descriptionRaw))
: null;

const experinceRawLowerCase = experienceRaw.toLowerCase();
Expand Down

0 comments on commit a7dfa08

Please sign in to comment.