Skip to content

Commit

Permalink
fix(fuselage): IconButton with badge click-animation (#1155)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored Sep 4, 2023
1 parent 9b325a1 commit 775de59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
7 changes: 1 addition & 6 deletions packages/fuselage/src/components/Button/Button.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@

@mixin click-animation() {
@include on-active {
> * {
transform: translateY(1px);
}
}
@include on-pressed {
> * {
> *:not(div[role='status']) {
transform: translateY(1px);
}
}
Expand Down
21 changes: 21 additions & 0 deletions packages/fuselage/src/components/Button/IconButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { css } from '@rocket.chat/css-in-js';
import {
Title,
Subtitle,
Expand All @@ -11,6 +12,8 @@ import type { ComponentStory, ComponentMeta } from '@storybook/react';
import React from 'react';

import { PropsVariationSection } from '../../../.storybook/helpers';
import { Badge } from '../Badge';
import Box from '../Box/Box';
import { ButtonGroup } from '../ButtonGroup';
import { IconButton } from './IconButton';

Expand Down Expand Up @@ -212,3 +215,21 @@ export const _IconButtonDanger: ComponentStory<typeof IconButton> = () => (
export const _IconButtonSecondaryDanger: ComponentStory<
typeof IconButton
> = () => <IconButton icon='balloon' aria-label='balloon' secondary danger />;

export const _IconButtonWithBadge: ComponentStory<typeof IconButton> = () => (
<ButtonGroup>
<IconButton icon='balloon' small position='relative' overflow='visible'>
<Box
position='absolute'
role='status'
className={css`
top: 0;
right: 0;
transform: translate(30%, -30%);
`}
>
<Badge variant='danger'>2</Badge>
</Box>
</IconButton>
</ButtonGroup>
);

0 comments on commit 775de59

Please sign in to comment.