Skip to content

Commit

Permalink
fix(fuselage): useCollapse expanded prop usage (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored Oct 17, 2024
1 parent 1265102 commit 1ca8371
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tasty-planets-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/fuselage": patch
---

fix(fuselage): adjust `SidebarCollapseGroup` padding
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ $sidebar-banner-color-danger: theme(
}
}

&-collapse-group__panel--expanded {
padding-block: lengths.padding(none);
}

&-accordion-item {
flex: 0 1 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { useToggle, useUniqueId } from '@rocket.chat/fuselage-hooks';
import type { KeyboardEventHandler, MouseEvent } from 'react';

const hasPropExpanded = (expanded: boolean | undefined) =>
expanded !== undefined;

export const useCollapse = ({
expanded: propExpanded,
defaultExpanded,
Expand All @@ -15,7 +18,7 @@ export const useCollapse = ({
tabIndex?: number;
}) => {
const [stateExpanded, toggleStateExpanded] = useToggle(defaultExpanded);
const expanded = propExpanded || stateExpanded;
const expanded = hasPropExpanded(propExpanded) ? propExpanded : stateExpanded;

const panelExpanded = noncollapsible || expanded;

Expand Down

0 comments on commit 1ca8371

Please sign in to comment.