diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 58732c7..7053f18 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,19 +1,25 @@ import { JSX, ParentComponent, Show, splitProps } from 'solid-js' import { twMerge } from 'tailwind-merge' +interface ButtonBaseProps extends JSX.ButtonHTMLAttributes { + loading?: boolean + disabled?: boolean +} + +interface ButtonWithIconProps extends ButtonBaseProps { + icon: JSX.Element + children?: JSX.Element +} + +interface ButtonWithoutIconProps extends ButtonBaseProps { + icon?: JSX.Element + children: JSX.Element +} + export const Button: ParentComponent< - JSX.ButtonHTMLAttributes & { - loading?: boolean - disabled?: boolean - icon?: JSX.Element - } + ButtonWithIconProps | ButtonWithoutIconProps > = (props) => { - const [local, others] = splitProps(props, [ - 'class', - 'loading', - 'disabled', - 'icon', - ]) + const [local, others] = splitProps(props, ['class', 'loading', 'icon']) return ( diff --git a/src/pages/Rules.tsx b/src/pages/Rules.tsx index 8be1c85..ffc64a7 100644 --- a/src/pages/Rules.tsx +++ b/src/pages/Rules.tsx @@ -59,7 +59,7 @@ export default () => { return (
-
+
{(tab) => ( + icon={ + + } + />
@@ -133,14 +134,15 @@ export default () => { class="btn-circle btn-sm absolute right-2 top-2 mr-2 h-4" disabled={updatingMap()[ruleProvider.name]} onClick={(e) => onUpdateProviderClick(e, ruleProvider.name)} - > - - + icon={ + + } + />
)}