Skip to content

Commit

Permalink
Fix active styles in Button
Browse files Browse the repository at this point in the history
  • Loading branch information
th3c0d3br34ker committed Sep 23, 2023
1 parent 5337850 commit 2e00ad2
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions packages/desktop-client/src/components/common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ const _getPadding = type => {
}
};

const _getActiveStyles = (type, bounce) => {
switch (type) {
case 'bare':
return { backgroundColor: theme.buttonBareBackgroundActive };
case 'link':
return {
transform: 'none',
boxShadow: 'none',
};
default:
return {
transform: bounce && 'translateY(1px)',
boxShadow: `0 1px 4px 0 ${
type === 'primary'
? theme.buttonPrimaryShadow
: theme.buttonNormalShadow
}`,
transition: 'none',
};
}
};

const Button = forwardRef<HTMLButtonElement, ButtonProps>(
(
{
Expand Down Expand Up @@ -131,17 +153,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
...hoveredStyle,
};
activeStyle = {
...(type === 'bare'
? { backgroundColor: theme.buttonBareBackgroundActive }
: {
transform: bounce && 'translateY(1px)',
boxShadow:
'0 1px 4px 0 ' +
(type === 'primary'
? theme.buttonPrimaryShadow
: theme.buttonNormalShadow),
transition: 'none',
}),
..._getActiveStyles(type, bounce),
...activeStyle,
};

Expand Down

0 comments on commit 2e00ad2

Please sign in to comment.