Sha256: 09f863e2064524fa4e0ae4c57d6faa0cd2f96e3ada0d364836d6613d254eb3e5

Contents?: true

Size: 897 Bytes

Versions: 11

Compression:

Stored size: 897 Bytes

Contents

/* @flow */
/* 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 } from '../utilities/globalProps'

type HighlightProps = {
  className?: string,
  data?: string,
  id?: string,
  children?: React.Node,
  text?: string,
  highlightedText?: array<string>,
}

const Highlight = (props: HighlightProps) => {
  const {
    className = 'pb_highlight_kit',
    children,
    data,
    id,
    text,
    highlightedText = ['highlight'],
  } = props
  return (
    <Highlighter
        autoEscape
        data={data}
        highlightClassName={classnames(globalProps(props), className)}
        highlightTag="mark"
        id={id}
        searchWords={highlightedText}
        textToHighlight={text || children}
    />
  )
}

export default Highlight

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.24.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.23.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.22.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx