<commit_before>// Numenta Web Platform and Sites source code
// MIT License (see LICENSE.txt)
// Copyright © 2005—2017 Numenta <http://numenta.com>

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

import styles from './index.css'


/**
 * External link only (browser location) for now.
 */
const ButtonLink = ({children, disabled, onClick, theme, target, to}) => {
  const classes = [styles.buttonLink, styles[theme]]

  if (disabled) classes.push(styles.disabled)
  else classes.push(styles.enabled)

  return (
    <a
      className={classNames(...classes)}
      href={to}
      onClick={onClick}
      target={target}
    >
      {children}
    </a>
  )
}

ButtonLink.propTypes = {
  children: React.PropTypes.node.isRequired,
  disabled: React.PropTypes.bool,
  onClick: React.PropTypes.func,
  target: React.PropTypes.string,
  theme: React.PropTypes.string,
  to: React.PropTypes.string.isRequired,
}

ButtonLink.defaultProps = {
  disabled: false,
  theme: 'primary',
}

export default ButtonLink
<commit_msg>WEB-514: Fix button links<commit_after>// Numenta Web Platform and Sites source code
// MIT License (see LICENSE.txt)
// Copyright © 2005—2017 Numenta <http://numenta.com>

import classNames from 'classnames'
import React from 'react'
import {prefixLink} from 'gatsby-helpers'

import styles from './index.css'


/**
 * External link only (browser location) for now.
 */
const ButtonLink = ({children, disabled, onClick, theme, target, to}) => {
  const classes = [styles.buttonLink, styles[theme]]

  if (disabled) classes.push(styles.disabled)
  else classes.push(styles.enabled)
  let link = to
  if (to && to.match(/^\/assets\//)) {
    link = prefixLink(to)
  }
  return (
    <a
      className={classNames(...classes)}
      href={link}
      onClick={onClick}
      target={target}
    >
      {children}
    </a>
  )
}

ButtonLink.propTypes = {
  children: React.PropTypes.node.isRequired,
  disabled: React.PropTypes.bool,
  onClick: React.PropTypes.func,
  target: React.PropTypes.string,
  theme: React.PropTypes.string,
  to: React.PropTypes.string.isRequired,
}

ButtonLink.defaultProps = {
  disabled: false,
  theme: 'primary',
}

export default ButtonLink

{'fraction_non_alphanumeric': 0.1346328195829556, 'fraction_numerical': 0.008612873980054397, 'mean_word_length': 3.5883575883575882, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '518375', 'n_tokens_mistral': 722, 'n_tokens_neox': 701, 'n_words': 179}