Sha256: df9d04352275ef16e4402c398780df7e94964a492ea1a88fb046e370621c8448

Contents?: true

Size: 1.5 KB

Versions: 357

Compression:

Stored size: 1.5 KB

Contents

/* eslint-disable react/jsx-no-target-blank */
/* eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */

import React from 'react'
import classnames from 'classnames'

import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps, GlobalProps } from '../utilities/globalProps'

import Badge from '../pb_badge/_badge'

type HashtagProps = {
  aria?: {[key: string]: string},
  className?: string,
  dark?: boolean,
  data?: string,
  id?: string,
  newWindow?: boolean,
  rel?: string,
  text?: string,
  type: "default" | "home" | "project" | "appointment",
  url?: string,
} & GlobalProps

const typeMap = {
  home: 'H#',
  project: 'P#',
  appointment: 'A#',
  default: '#',
}

const Hashtag = (props: HashtagProps) => {
  const {
    aria = {},
    className,
    dark = false,
    data = {},
    id,
    newWindow,
    rel,
    text,
    type = 'default',
    url,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(buildCss('pb_hashtag_kit'), globalProps(props), className)

  return (
    <span
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      <a
          href={url}
          rel={(newWindow ? "noreferrer" : rel)}
          target={(newWindow ? '_blank' : '_self')}
      >
        <Badge
            dark={dark}
            text={typeMap[type] + text}
            variant="primary"
        />
      </a>
    </span>
  )
}

export default Hashtag

Version data entries

357 entries across 357 versions & 1 rubygems

Version Path
playbook_ui-11.9.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.8.1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.8.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.7.0.pre.alpha.table1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.7.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.6.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.5.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.7.0.pre.alpha.pre.guagechart1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.6.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.5.0.pre.alpha.datepicker1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.6.0.pre.alpha.rubocopperf1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.6.1.pre.alpha.rubocop.pre.performance1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.5.0.pre.alpha.pre.rubocop app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.6.0.pre.alpha.momenttz1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.5.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.4.0.pre.alpha.rubytheme2 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.4.0.pre.alpha.rubytheme1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx