diff --git a/static/app/components/core/button/index.tsx b/static/app/components/core/button/index.tsx index be046c640e2c48..781d5819ade030 100644 --- a/static/app/components/core/button/index.tsx +++ b/static/app/components/core/button/index.tsx @@ -1,6 +1,6 @@ import {forwardRef as reactForwardRef, useCallback} from 'react'; import isPropValid from '@emotion/is-prop-valid'; -import type {Theme} from '@emotion/react'; +import type {SerializedStyles, Theme} from '@emotion/react'; import {css} from '@emotion/react'; import styled from '@emotion/styled'; import type {LocationDescriptor} from 'history'; @@ -14,6 +14,17 @@ import HookStore from 'sentry/stores/hookStore'; import {space} from 'sentry/styles/space'; import mergeRefs from 'sentry/utils/mergeRefs'; +/** + * Default sizes to use for SVGIcon + */ +const ICON_SIZES: Partial< + Record, SVGIconProps['size']> +> = { + xs: 'xs', + sm: 'sm', + md: 'sm', +}; + /** * The button can actually also be an anchor or React router Link (which seems * to be poorly typed as `any`). So this is a bit of a workaround to receive @@ -50,20 +61,11 @@ interface CommonButtonProps { * Indicates that the button is "doing" something. */ busy?: boolean; - /** - * Disables the button, assigning appropriate aria attributes and disallows - * interactions with the button. - */ - disabled?: boolean; /** * The icon to render inside of the button. The size will be set * appropriately based on the size of the button. */ icon?: React.ReactNode; - /** - * Used when the button is part of a form. - */ - name?: string; /** * The semantic "priority" of the button. Use `primary` when the action is * contextually the primary action, `danger` if the button will do something @@ -140,9 +142,7 @@ interface ButtonPropsWithAriaLabel extends BaseButtonProps { export type ButtonProps = ButtonPropsWithoutAriaLabel | ButtonPropsWithAriaLabel; -export interface BaseLinkButtonProps - extends CommonButtonProps, - ElementProps { +interface BaseLinkButtonProps extends CommonButtonProps, ElementProps { /** * @internal Used in the Button forwardRef */ @@ -201,17 +201,6 @@ export type LinkButtonProps = | HrefLinkButtonPropsWithChildren | HrefLinkButtonPropsWithAriaLabel; -/** - * Default sizes to use for SVGIcon - */ -const ICON_SIZES: Partial< - Record, SVGIconProps['size']> -> = { - xs: 'xs', - sm: 'sm', - md: 'sm', -}; - function BaseButton({ size = 'md', to, @@ -225,7 +214,8 @@ function BaseButton({ borderless, translucentBorder, priority, - disabled = false, + disabled, + type = 'button', tooltipProps, onClick, analyticsEventName, @@ -287,8 +277,8 @@ function BaseButton({ ); const hasChildren = Array.isArray(children) - ? children.some(child => !isEmptyChild(child)) - : !isEmptyChild(children); + ? children.some(child => !!child || String(child) === '0') + : !!children || String(children) === '0'; // Buttons come in 4 flavors: , , , and