Edited button component

This commit is contained in:
Patrick Alvin Alcala 2025-08-26 16:23:47 +08:00
parent 3905923985
commit d0652e52a5
2 changed files with 20 additions and 17 deletions

View file

@ -4,13 +4,13 @@
.button .button
background: vars.$primaryColor background: vars.$primaryColor
border: none border: none
border-radius: 16px border-radius: 32px
color: white color: white
padding: 0.5rem 1.25rem padding: 0.5rem 1.25rem
text-align: center text-align: center
text-decoration: none text-decoration: none
display: inline-block display: inline-block
font-size: 0.75rem font-size: 1rem
font-weight: 700 font-weight: 700
cursor: pointer cursor: pointer
transition: all 0.2s ease-out transition: all 0.2s ease-out

View file

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