Sha256: 5b1f742a17ebe9903a95e913cc885b62268e6955b7fb4df9819dcb1cda21b60a

Contents?: true

Size: 1.24 KB

Versions: 189

Compression:

Stored size: 1.24 KB

Contents

/* @flow */
/* eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */

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

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

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

189 entries across 189 versions & 1 rubygems

Version Path
playbook_ui-9.3.0.alpha.inline2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.3.0.alpha.inline1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.3.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.2.2.pre.alpha.margin app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.2.2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.2.1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.2.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.1.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-9.0.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.3.0.alpha.select.pre.margin app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.3.0 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.pre.alpha5 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.pre.alpha4 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.alpha.iconacc app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.pre.alpha3 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.pre.alpha2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.3.0.deps2 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.3.0.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
playbook_ui-8.2.1.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.jsx