This commit is contained in:
Patrick Alvin Alcala 2026-03-26 14:54:44 +08:00
parent 50def158c2
commit 82a0fd6eea
8 changed files with 56 additions and 535 deletions

View file

@ -1,11 +1,9 @@
---
interface Props {
label?: string
to?: string
onClick?: () => void
to: string
edges?: 'curved' | 'rounded' | 'flat'
design?: 'bu-primary' | 'bu-link' | 'bu-info' | 'bu-success' | 'bu-warning' | 'bu-danger' | 'bu-dark' | 'bu-light' | 'bu-text' | 'bu-ghost' | 'bo-primary' | 'bo-secondary' | 'bo-success' | 'bo-danger' | 'bo-warning' | 'bo-info' | 'bo-light' | 'bo-dark' | 'bo-link'
submit?: boolean
newtab?: boolean
}
@ -22,50 +20,23 @@ const getBorderRadius = (edge: Props['edges']) => {
}
}
const { label, to, edges, design, submit, newtab } = Astro.props
const { label, to, edges, design, newtab } = Astro.props
const borderRadius = getBorderRadius(edges)
---
<script>
const button = document.getElementById('button')!
button.addEventListener('click', () => {
onClick
})
</script>
{
to ? (
design ? (
<a href={to} aria-label={label} rel="noopener" target={newtab ? '_blank' : '_self'} data-astro-prefetch>
<button class={design} style={borderRadius}>
{label || 'Click Me!'}
</button>
</a>
) : (
<a href={to} aria-label={label} rel="noopener" target={newtab ? '_blank' : '_self'} data-astro-prefetch>
<button class="dasig-button" style={borderRadius}>
{label || 'Click Me!'}
</button>
</a>
)
) : design ? (
submit ? (
<button class={design} type="submit" style={borderRadius}>
design ? (
<a href={to} aria-label={label} rel="noopener" target={newtab ? '_blank' : '_self'} data-astro-prefetch>
<button class={design} style={borderRadius}>
{label || 'Click Me!'}
</button>
) : (
<button class={design} id="button" style={borderRadius}>
{label || 'Click Me!'}
</button>
)
) : submit ? (
<button class="dasig-button" type="submit" style={borderRadius}>
{label || 'Click Me!'}
</button>
</a>
) : (
<button class="dasig-button" id="button" style={borderRadius}>
{label || 'Click Me!'}
</button>
<a href={to} aria-label={label} rel="noopener" target={newtab ? '_blank' : '_self'} data-astro-prefetch>
<button class="dasig-button" style={borderRadius}>
{label || 'Click Me!'}
</button>
</a>
)
}