Skip to content

Commit

Permalink
fix(CompositeBar): recalc mounted PopupPosition if compact mode chang…
Browse files Browse the repository at this point in the history
…ed (#138)
  • Loading branch information
DarkGenius authored Oct 17, 2023
1 parent a88cbf0 commit 56ac451
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const AsideHeaderShowcase: FC<AsideHeaderShowcaseProps> = ({
popupPlacement={['right-end']}
popupOffset={[-20, 10]}
onClosePopup={() => setPopupVisible(false)}
popupKeepMounted={true}
renderPopupContent={() => {
return (
<div className={b('settings')}>
Expand Down
14 changes: 14 additions & 0 deletions src/components/CompositeBar/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ export const Item: React.FC<ItemInnerProps> = (props) => {
const iconSize = item.iconSize || ASIDE_HEADER_ICON_SIZE;
const collapsedItem = item.id === COLLAPSE_ITEM_ID;

const modifiers: Required<PopupProps>['modifiers'] = React.useMemo(
() => [
{
name: 'compact',
enabled: true,
options: {compact},
phase: 'main',
fn() {},
},
],
[compact],
);

const onClose = React.useCallback(
(event: MouseEvent | KeyboardEvent) => {
if (
Expand Down Expand Up @@ -191,6 +204,7 @@ export const Item: React.FC<ItemInnerProps> = (props) => {
offset={popupOffset}
anchorRef={anchorRef}
onClose={onClose}
modifiers={modifiers}
>
{renderPopupContent()}
</Popup>
Expand Down

0 comments on commit 56ac451

Please sign in to comment.