Sha256: 896bd705a1ad4214b568c02ea72033a77149af58c88bb8378b97bfa055a2f69f

Contents?: true

Size: 1.25 KB

Versions: 78

Compression:

Stored size: 1.25 KB

Contents

/* @flow */
/* 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 } from '../utilities/globalProps'

import Badge from '../pb_badge/_badge'

type HashtagProps = {
  aria?: object,
  className?: string,
  dark?: boolean,
  data?: string,
  id?: string,
  text?: string,
  type: "default" | "home" | "project" | "appointment",
  url?: string,
}

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

const Hashtag = (props: HashtagProps) => {
  const {
    aria = {},
    className,
    dark = false,
    data = {},
    id,
    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}>
        <Badge
            dark={dark}
            text={typeMap[type] + text}
            variant="primary"
        />
      </a>
    </span>
  )
}

export default Hashtag

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.2.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.1.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.0.pre.alphafonts app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-10.0.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx