diff --git a/src/components/ActionButton.tsx b/src/components/ActionButton.tsx index fc3fc35a1..43fd8f492 100644 --- a/src/components/ActionButton.tsx +++ b/src/components/ActionButton.tsx @@ -7,10 +7,10 @@ import Button from './Button' import Row, { RowProps } from './Row' import Tooltip from './Tooltip' -const StyledButton = styled(Button)<{ shouldUseDisabledColor?: boolean }>` - border-radius: ${({ theme }) => theme.borderRadius.medium}em; +const StyledButton = styled(Button)<{ shouldUseDisabledColor?: boolean; narrow?: boolean }>` + border-radius: ${({ theme, narrow }) => (narrow ? theme.borderRadius.small : theme.borderRadius.medium)}em; flex-grow: 1; - max-height: 56px; + max-height: ${({ narrow }) => (narrow ? '2.5em' : '3.5em')}; transition: background-color ${AnimationSpeed.Medium} ease-out, border-radius ${AnimationSpeed.Medium} ease-out, flex-grow ${AnimationSpeed.Medium} ease-out; ${({ theme, disabled, shouldUseDisabledColor }) => @@ -57,11 +57,11 @@ const actionCss = css` } ` -export const Overlay = styled(Row)<{ hasAction: boolean }>` - border-radius: ${({ theme }) => theme.borderRadius.medium}em; +export const Overlay = styled(Row)<{ hasAction: boolean; narrow?: boolean }>` + border-radius: ${({ theme, narrow }) => (narrow ? theme.borderRadius.small : theme.borderRadius.medium)}em; flex-flow: row-reverse nowrap; margin-top: 0.25em; - min-height: 3.5em; + min-height: ${({ narrow }) => (narrow ? '2.5em' : '3.5em')}; transition: padding ${AnimationSpeed.Medium} ease-out; ${({ hasAction }) => hasAction && actionCss} ` @@ -84,6 +84,7 @@ interface BaseProps { action?: Action wrapperProps?: Omit, keyof RowProps> shouldUseDisabledColor?: boolean + narrow?: boolean } export type ActionButtonProps = BaseProps & Omit, keyof BaseProps> @@ -96,6 +97,7 @@ export default function ActionButton({ onClick, children, wrapperProps, + narrow, ...rest }: ActionButtonProps) { const textColor = useMemo(() => { @@ -115,17 +117,27 @@ export default function ActionButton({ } }, [color, disabled]) + const buttonSize = useMemo(() => (narrow ? 'small' : action ? 'medium' : 'large'), [narrow, action]) + return ( - + {!action?.hideButton && ( - + {action?.children || children}