Sha256: 28572b643870aa4ee15755e60abb22fa2606597f6ceaff13983fd5efa9f591ce

Contents?: true

Size: 900 Bytes

Versions: 101

Compression:

Stored size: 900 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.js'

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

101 entries across 101 versions & 1 rubygems

Version Path
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.2.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.1.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.0.pre.alphafonts app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-10.0.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.19.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.18.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.17.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-9.16.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx