summaryrefslogtreecommitdiff
path: root/client/components/UI/Link.jsx
blob: d71582b44c8067a83da9b5419ffaf1e83c73b1ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { h, Component } from 'preact'
import React from 'react'
// import PropTypes from 'prop-types'

const Link = ({ active, children, onClick, disabled }) => {
  if (active) {
    return <span>{children}</span>
  }
  const className = disabled ? 'disabled' : ''

  return (
    // eslint-disable-next-line
    <a 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