GHHG10's picture
download
raw
1.11 kB
import { Button as Kobalte } from "@kobalte/core/button"
import { type ComponentProps, Show, createMemo, splitProps } from "solid-js"
import { Icon, type IconProps } from "./icon"
import "./button-v2.css"
export interface ButtonV2Props
extends ComponentProps<typeof Kobalte>,
Pick<ComponentProps<"button">, "class" | "classList" | "children"> {
size?: "small" | "normal" | "large"
variant?: "neutral" | "contrast" | "ghost" | "ghost-muted"
icon?: IconProps["name"]
}
export function ButtonV2(props: ButtonV2Props) {
const [split, rest] = splitProps(props, ["variant", "size", "icon", "class", "classList"])
const resolvedIcon = createMemo(() => split.icon)
return (
<Kobalte
{...rest}
data-component="button-v2"
data-size={split.size || "normal"}
data-variant={split.variant || "neutral"}
data-icon={resolvedIcon()}
classList={{
...split.classList,
[split.class ?? ""]: !!split.class,
}}
>
<Show when={resolvedIcon()}>
<Icon name={resolvedIcon()!} />
</Show>
{props.children}
</Kobalte>
)
}

Xet Storage Details

Size:
1.11 kB
·
Xet hash:
9a1eb73a943bcf19690fc268644b655e2c6120d83bfe69a3f7f9afcd0737789c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.