import { h, Component } from 'preact'
import React from 'react'
// import PropTypes from 'prop-types'

const Link = ({ href, active, children, onClick, selected, disabled }) => {
  if (active) {
    return <span>{children}</span>
  }
  const className = disabled ? 'disabled' :
                    selected ? 'selected' : ''
  return (
    // eslint-disable-next-line
    <a href={href || '#'}
       class={className}
       onClick={e => {
         e.preventDefault()
         onClick()
       }}
    >
      {children}
    </a>
  )
}

// Link.propTypes = {
//   active: PropTypes.bool.isRequired,
//   children: PropTypes.node.isRequired,
//   onClick: PropTypes.func.isRequired
// }

export default Link
