Commit da8884d8 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: action prop warning (#3304)

parent 79bdc0c5
...@@ -45,13 +45,13 @@ const actionCss = css` ...@@ -45,13 +45,13 @@ const actionCss = css`
} }
` `
export const Overlay = styled(Row)<{ action?: boolean }>` export const Overlay = styled(Row)<{ hasAction: boolean }>`
border-radius: ${({ theme }) => theme.borderRadius}em; border-radius: ${({ theme }) => theme.borderRadius}em;
flex-direction: row-reverse; flex-direction: row-reverse;
min-height: 3.5em; min-height: 3.5em;
transition: padding 0.25s ease-out; transition: padding 0.25s ease-out;
${({ action }) => action && actionCss} ${({ hasAction }) => hasAction && actionCss}
` `
export interface Action { export interface Action {
...@@ -72,7 +72,7 @@ export interface ActionButtonProps { ...@@ -72,7 +72,7 @@ export interface ActionButtonProps {
export default function ActionButton({ color = 'accent', disabled, action, onClick, children }: ActionButtonProps) { export default function ActionButton({ color = 'accent', disabled, action, onClick, children }: ActionButtonProps) {
const textColor = useMemo(() => (color === 'accent' && !disabled ? 'onAccent' : 'currentColor'), [color, disabled]) const textColor = useMemo(() => (color === 'accent' && !disabled ? 'onAccent' : 'currentColor'), [color, disabled])
return ( return (
<Overlay action={Boolean(action)} flex align="stretch"> <Overlay hasAction={Boolean(action)} flex align="stretch">
<StyledButton color={color} disabled={disabled} onClick={action ? action.onClick : onClick}> <StyledButton color={color} disabled={disabled} onClick={action ? action.onClick : onClick}>
<ThemedText.TransitionButton buttonSize={action ? 'medium' : 'large'} color={textColor}> <ThemedText.TransitionButton buttonSize={action ? 'medium' : 'large'} color={textColor}>
{action ? action.children : children} {action ? action.children : children}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment