Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fuselage): Responsive CardControls #1443

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
5 changes: 5 additions & 0 deletions .changeset/purple-shirts-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/fuselage": patch
---

Fixes the responsiveness of the card component by adding flex wrap to card controls such that it can accomodate multiple items without breaking the responsive behaviour
Barrylimarti marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions packages/fuselage/src/components/Card/Card.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,16 @@ $card-hero-padding: lengths.padding(28);
display: flex;
align-items: center;
}

&__controls {
flex-wrap: wrap;
}

&__horizontal &__controls {
flex-wrap: nowrap;

&--wrap {
flex-wrap: wrap;
}
}
Barrylimarti marked this conversation as resolved.
Show resolved Hide resolved
}
14 changes: 11 additions & 3 deletions packages/fuselage/src/components/Card/CardControls.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
const CardControls = ({ ...props }) => (
<div className='rcx-card__controls' {...props} />
);
import { useBreakpoints } from '@rocket.chat/fuselage-hooks';

import Box from '../Box/Box';

const CardControls = ({ ...props }) => {
const breakpoints = useBreakpoints();
const isMobile = !breakpoints.includes('sm');
return (
<Box rcx-card__controls rcx-card__controls--wrap={isMobile} {...props} />
);
};
Barrylimarti marked this conversation as resolved.
Show resolved Hide resolved

export default CardControls;