fwt/src/builtin-components/Button/Button.tsx

26 lines
536 B
TypeScript

import './Button.sass'
import { Show } from 'solid-js'
interface Props {
label?: string
to?: string
onClick?: () => void
}
export default (props: Props) => {
return (
<>
<Show when={props.to}>
<a href={props.to} aria-label={props.label}>
<button class="button">{props.label || 'Click Me!'}</button>
</a>
</Show>
<Show when={!props.to}>
<button class="button" onClick={props.onClick}>
{props.label || 'Click Me!'}
</button>
</Show>
</>
)
}