react-instantsearch-dom#Snippet JavaScript Examples
The following examples show how to use
react-instantsearch-dom#Snippet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hitcomps.js From emprezzo with MIT License | 6 votes |
PageHit = clickHandler => ({ hit }) => (
<div>
<Link to={hit.slug} onClick={clickHandler}>
<h4>
<Highlight attribute="title" hit={hit} tagName="mark" />
</h4>
</Link>
<Snippet attribute="excerpt" hit={hit} tagName="mark" />
</div>
)
Example #2
Source File: hitcomps.js From emprezzo with MIT License | 6 votes |
PostHit = clickHandler => ({ hit }) => (
<div>
<Link to={`/blog` + hit.slug} onClick={clickHandler}>
<h4>
<Highlight attribute="title" hit={hit} tagName="mark" />
</h4>
</Link>
<div>
<Calendar size="1em" />
<Highlight attribute="date" hit={hit} tagName="mark" />
 
<Tags size="1em" />
{hit.tags.map((tag, index) => (
<Fragment key={tag}>
{index > 0 && `, `}
{tag}
</Fragment>
))}
</div>
<Snippet attribute="excerpt" hit={hit} tagName="mark" />
</div>
)
Example #3
Source File: hitComps.js From cardano-documentation with MIT License | 6 votes |
PageHit =
(clickHandler) =>
({ hit }) => {
hit.slug = stripNumbers(hit.slug)
return (
<div>
<Link to={hit.slug} onClick={clickHandler}>
<div>
<Highlight attribute="title" hit={hit} tagName="mark" />
</div>
</Link>
<Snippet attribute="excerpt" hit={hit} tagName="mark" />
</div>
)
}
Example #4
Source File: hitComps.js From learningHub with MIT License | 6 votes |
PageHit = clickHandler => ({ hit }) => (
<div>
<Link to={hit.slug} onClick={clickHandler}>
<div>
<Highlight attribute="title" hit={hit} tagName="mark" />
</div>
</Link>
<Snippet attribute="excerpt" hit={hit} tagName="mark" />
</div>
)
Example #5
Source File: suggestion.js From Nextjs-ja-translation-docs with MIT License | 5 votes |
export default function Suggestion({ hit }) {
return (
<Link {...getHitLinkProps(hit)}>
<a>
<span className="suggestion__title">
<Highlight hit={hit} attribute="title" tagName="mark" />
</span>
{hit.section && (
<span className="suggestion__section">
<Highlight hit={hit} attribute="section" tagName="mark" />
{hit.subSection && (
<>
{' '}
- <Highlight hit={hit} attribute="subSection" tagName="mark" />
</>
)}
</span>
)}
<span className="suggestion__content">
<Snippet hit={hit} attribute="content" tagName="mark" />
</span>
<style jsx>{`
.suggestion__title {
font-weight: 500;
margin-bottom: 0.5rem;
display: flex;
}
.suggestion__section {
font-size: 0.875rem;
font-weight: 500;
margin-bottom: 0.5rem;
display: block;
}
.suggestion__content {
color: #333333;
display: block;
line-height: 1.6;
}
`}</style>
</a>
</Link>
);
}