mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 21:55:38 +08:00
24 lines
563 B
TypeScript
24 lines
563 B
TypeScript
|
import { JSX, ParentComponent, Show, splitProps } from 'solid-js'
|
||
|
import { twMerge } from 'tailwind-merge'
|
||
|
|
||
|
export const Button: ParentComponent<
|
||
|
JSX.HTMLAttributes<HTMLButtonElement> & {
|
||
|
loading?: boolean
|
||
|
}
|
||
|
> = (props) => {
|
||
|
const [local, others] = splitProps(props, ['class', 'loading'])
|
||
|
|
||
|
return (
|
||
|
<button
|
||
|
class={twMerge('btn', local.loading ? 'btn-disabled' : local.class)}
|
||
|
{...others}
|
||
|
>
|
||
|
<Show when={local.loading}>
|
||
|
<span class="loading loading-spinner" />
|
||
|
</Show>
|
||
|
|
||
|
{props.children}
|
||
|
</button>
|
||
|
)
|
||
|
}
|