Sha256: 826eb89016aec0ca20ede0e5343802d0b77b472ebc537e9bd49d076b26cc5f7f

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

/* 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,
  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,
    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

20 entries across 20 versions & 1 rubygems

Version Path
playbook_ui-11.4.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.3.0.pre.alpha2 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.3.0.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.3.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.7 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.6 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.5 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.4 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.3 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.2 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.2.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.1.2 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.1.2.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.1.1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.1.1.pre.alpha1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.1.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.0.1 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
playbook_ui-11.0.0 app/pb_kits/playbook/pb_hashtag/_hashtag.tsx