import { Component, JSX, Match, mergeProps, splitProps, Switch } from 'solid-js'; import styles from './button.module.scss'; import { combineClassList } from '../../../utils/combineClassList.ts'; interface BaseButtonProps { variant?: 'solid' | 'light' | 'outline' | 'flat' | 'ghost' | 'glow'; size?: 'tiny' |'small' | 'medium' | 'large'; color?: 'primary'; darkMode?: boolean; disabled?: boolean; } type RealButtonProps = BaseButtonProps & { as?: 'button' | undefined; } & JSX.ButtonHTMLAttributes; type LinkButtonProps = BaseButtonProps & { as: 'link'; } & JSX.AnchorHTMLAttributes; type ButtonProps = RealButtonProps | LinkButtonProps; const RealButton: Component = (props: RealButtonProps) => { props = mergeProps( { variant: 'solid' as ButtonProps['variant'], color: 'primary' as ButtonProps['color'], size: 'medium' as ButtonProps['size'], }, props, ); const [style, children, others] = splitProps( props, ['variant', 'color', 'darkMode', 'disabled', 'class', 'classList', 'size'], ['children'], ); const mainClass = () => styles[`button-${style.variant}-${style.color}`]; return ( ); }; const LinkButton: Component = (props: LinkButtonProps) => { props = mergeProps( { variant: 'solid' as ButtonProps['variant'], color: 'primary' as ButtonProps['color'], size: 'medium' as ButtonProps['size'], }, props, ); const [style, children, others] = splitProps( props, ['variant', 'color', 'darkMode', 'disabled', 'class', 'classList', 'size'], ['children'], ); const mainClass = () => styles[`button-${style.variant}-${style.color}`]; return ( {children.children} ); }; export const Button: Component = (props: ButtonProps) => { return ( ); };