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-13.8.0.pre.alpha.PLAY1016reactionbuttonemojibug1245 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.8.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1234 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1232 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1231 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.7.0.pre.alpha.play978makehighchartsadevdependencypoc1223 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.6.0.pre.alpha.play845allkitsbytypes1219 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.7.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.6.0.pre.alpha.tiptapreacthookformbug1210 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.6.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.5.0.pre.alpha.play984collapsiblekithidestooltips1203 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.5.0.pre.alpha.PLAY823globalpropoverflow1191 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.5.0.pre.alpha.PLAY823globalpropoverflow1188 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.5.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.4.0.pre.alpha.PLAY973Hash1181 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.4.0.pre.alpha.play961turnoffdeprecationwarnings1171 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.4.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.3.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.2.0.pre.alpha.PLAY986dateTimeRounding1150 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-13.2.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx