mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
* add menu item * add pages * add build search script Add custom algolia component * fix image in post width Delete useless file Modify post data to algolia script
38 lines
822 B
TypeScript
38 lines
822 B
TypeScript
import { FC } from 'react';
|
|
import { HitsProvided } from 'react-instantsearch-core';
|
|
import { connectHits } from 'react-instantsearch-dom';
|
|
import CustomHighlight from './CustomHighlight';
|
|
|
|
export interface PostHits {
|
|
objectID: string;
|
|
title: string;
|
|
id: string;
|
|
desc: string;
|
|
date: Date;
|
|
tags: string | string[];
|
|
categories: string;
|
|
url: string;
|
|
index_img: string;
|
|
}
|
|
|
|
const Hits: FC<HitsProvided<PostHits>> = ({ hits }) => {
|
|
return (
|
|
<>
|
|
<ol>
|
|
{hits.map((item) => {
|
|
return (
|
|
<li key={item.objectID}>
|
|
<CustomHighlight attribute="title" hit={item} />
|
|
<CustomHighlight attribute="desc" hit={item} />
|
|
</li>
|
|
);
|
|
})}
|
|
</ol>
|
|
</>
|
|
);
|
|
};
|
|
|
|
const CustomHits = connectHits(Hits);
|
|
|
|
export default CustomHits;
|