31 lines
687 B
TypeScript
Raw Normal View History

2024-11-09 14:37:09 +00:00
import React from "react";
import { GetProps, Button as BaseButton, Spinner } from "tamagui";
2024-11-16 23:50:02 +07:00
import Icons from "./icons";
2024-11-09 14:37:09 +00:00
type ButtonProps = GetProps<typeof BaseButton> & {
isDisabled?: boolean;
isLoading?: boolean;
};
const Button = ({ icon, isLoading, isDisabled, ...props }: ButtonProps) => {
return (
<BaseButton
icon={isLoading ? <Spinner /> : icon}
disabled={isLoading || isDisabled || props.disabled}
{...props}
/>
);
};
2024-11-16 23:50:02 +07:00
export const BackButton = (props: GetProps<typeof Button>) => (
<Button
circular
bg="$colorTransparent"
icon={<Icons name="arrow-left" size={24} />}
mr={6}
{...props}
/>
);
2024-11-09 14:37:09 +00:00
export default Button;