Sha256: bd25e046ba9f9ca933b84347f966591e258accdbfd921697e684cbcc16a6103c
Contents?: true
Size: 1 KB
Versions: 7
Compression:
Stored size: 1 KB
Contents
/* eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */ import Highlighter from 'react-highlight-words' import React from 'react' import classnames from 'classnames' import { globalProps, GlobalProps } from '../utilities/globalProps' type HighlightProps = { className?: string, data?: {[key: string]: string}, id?: string, children?: React.ReactChild[] | string, text?: string, highlightedText?: string[], } & GlobalProps const Highlight = (props: HighlightProps): React.ReactElement => { const { children, className = 'pb_highlight_kit', data = {}, highlightedText = ['highlight'], id = '', text = '', } = props const highlightContent: any = text || children; return ( <Highlighter autoEscape data={data} highlightClassName={classnames(globalProps(props), className)} highlightTag="mark" id={id} searchWords={highlightedText} textToHighlight={highlightContent} /> ) } export default Highlight
Version data entries
7 entries across 7 versions & 1 rubygems