23 lines
No EOL
492 B
TypeScript
23 lines
No EOL
492 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>
|
|
</>
|
|
} |