blob: b4d2d28ceb967da14fdb25b12d8a79725d1ee0d6 (
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 = ({ 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
|