Sha256: 68d539df7eae92e04dba30939195527300acd20f3788f4bb18f2194fcaf23dca

Contents?: true

Size: 888 Bytes

Versions: 44

Compression:

Stored size: 888 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 { spacing } from '../utilities/spacing.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(className, spacing(props))}
        highlightTag="span"
        id={id}
        searchWords={highlightedText}
        textToHighlight={text || children}
    />
  )
}

export default Highlight

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_highlight/_highlight.jsx