Edited button component
This commit is contained in:
parent
3905923985
commit
d0652e52a5
2 changed files with 20 additions and 17 deletions
|
|
@ -2,22 +2,25 @@ import './Button.sass'
|
|||
import { Show } from 'solid-js'
|
||||
|
||||
interface Props {
|
||||
label?: string;
|
||||
to?: string;
|
||||
onClick?: () => void;
|
||||
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>
|
||||
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>
|
||||
</>
|
||||
}
|
||||
<Show when={!props.to}>
|
||||
<button class="button" onClick={props.onClick}>
|
||||
{props.label || 'Click Me!'}
|
||||
</button>
|
||||
</Show>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue