Sha256: 127e890717b6ae83ea50dea02c83ea405714a6830bc98e9174f38d707d449f3e

Contents?: true

Size: 900 Bytes

Versions: 37

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(className, globalProps(props))}
        highlightTag="span"
        id={id}
        searchWords={highlightedText}
        textToHighlight={text || children}
    />
  )
}

export default Highlight

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.5.2 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.5.1 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-6.5.0 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha3 app/pb_kits/playbook/pb_highlight/_highlight.jsx
playbook_ui-7.0.1.pre.alpha2 app/pb_kits/playbook/pb_highlight/_highlight.jsx