Fix FloatingButton to behave like FloatingIconButton in a group. (#3524)
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -22,7 +22,7 @@ export type FloatingButtonProps = {
|
|||||||
const StyledButton = styled.button<
|
const StyledButton = styled.button<
|
||||||
Pick<
|
Pick<
|
||||||
FloatingButtonProps,
|
FloatingButtonProps,
|
||||||
'size' | 'focus' | 'position' | 'applyBlur' | 'applyShadow'
|
'size' | 'focus' | 'position' | 'applyBlur' | 'applyShadow' | 'position'
|
||||||
>
|
>
|
||||||
>`
|
>`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -31,7 +31,18 @@ const StyledButton = styled.button<
|
|||||||
|
|
||||||
border: ${({ focus, theme }) =>
|
border: ${({ focus, theme }) =>
|
||||||
focus ? `1px solid ${theme.color.blue}` : 'none'};
|
focus ? `1px solid ${theme.color.blue}` : 'none'};
|
||||||
border-radius: ${({ theme }) => theme.border.radius.sm};
|
border-radius: ${({ position, theme }) => {
|
||||||
|
switch (position) {
|
||||||
|
case 'left':
|
||||||
|
return `${theme.border.radius.sm} 0px 0px ${theme.border.radius.sm}`;
|
||||||
|
case 'right':
|
||||||
|
return `0px ${theme.border.radius.sm} ${theme.border.radius.sm} 0px`;
|
||||||
|
case 'middle':
|
||||||
|
return '0px';
|
||||||
|
case 'standalone':
|
||||||
|
return theme.border.radius.sm;
|
||||||
|
}
|
||||||
|
}};
|
||||||
box-shadow: ${({ theme, applyShadow, focus }) =>
|
box-shadow: ${({ theme, applyShadow, focus }) =>
|
||||||
applyShadow
|
applyShadow
|
||||||
? `0px 2px 4px 0px ${
|
? `0px 2px 4px 0px ${
|
||||||
@ -84,6 +95,7 @@ export const FloatingButton = ({
|
|||||||
Icon,
|
Icon,
|
||||||
title,
|
title,
|
||||||
size = 'small',
|
size = 'small',
|
||||||
|
position = 'standalone',
|
||||||
applyBlur = true,
|
applyBlur = true,
|
||||||
applyShadow = true,
|
applyShadow = true,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
@ -97,6 +109,7 @@ export const FloatingButton = ({
|
|||||||
size={size}
|
size={size}
|
||||||
applyBlur={applyBlur}
|
applyBlur={applyBlur}
|
||||||
applyShadow={applyShadow}
|
applyShadow={applyShadow}
|
||||||
|
position={position}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
{Icon && <Icon size={theme.icon.size.sm} />}
|
{Icon && <Icon size={theme.icon.size.sm} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user