Skip to content

Commit 18a33f4

Browse files
authored
fix(fuselage): Keep displaying button when Menu is opened (#1633)
1 parent e509e48 commit 18a33f4

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

.changeset/lazy-facts-tie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/fuselage': patch
3+
---
4+
5+
fix(fuselage): Keep displaying button when Menu is opened

packages/fuselage/src/components/Option/Option.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Option', () => {
2525

2626
getByText('Option').click();
2727

28-
expect(click).toBeCalledTimes(1);
28+
expect(click).toHaveBeenCalledTimes(1);
2929
});
3030

3131
it('should call prevent when click on disabled', () => {
@@ -39,7 +39,7 @@ describe('Option', () => {
3939

4040
getByText('Option').click();
4141

42-
expect(click).toBeCalledTimes(0);
43-
expect(prevent).toBeCalledTimes(1);
42+
expect(click).toHaveBeenCalledTimes(0);
43+
expect(prevent).toHaveBeenCalledTimes(1);
4444
});
4545
});

packages/fuselage/src/components/Option/Option.stories.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { exampleAvatar, menuOptions } from '../../../.storybook/helpers';
55
import { Avatar } from '../Avatar';
66
import Box from '../Box';
77
import { Menu } from '../Menu';
8+
import { MenuItem, MenuV2 } from '../Menu/V2';
89
import { StatusBullet } from '../StatusBullet';
910
import Tile from '../Tile';
1011

@@ -127,6 +128,36 @@ export const WithMenu: StoryFn<typeof Option> = () => (
127128
</>
128129
);
129130

131+
export const WithMenuV2: StoryFn<typeof Option> = () => (
132+
<>
133+
<Option onClick={action('click')}>
134+
<OptionContent>Lorem Ipsum Lorem</OptionContent>
135+
</Option>
136+
<Option>
137+
<OptionAvatar>
138+
<Avatar url={exampleAvatar} size='x28' />
139+
</OptionAvatar>
140+
<OptionColumn>
141+
<StatusBullet />
142+
</OptionColumn>
143+
<OptionContent>
144+
Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem
145+
</OptionContent>
146+
<OptionMenu>
147+
<MenuV2
148+
detached
149+
small
150+
items={[{ id: '1', label: 'Option', icon: 'hashtag' }]}
151+
>
152+
<MenuItem key='1'>Profile</MenuItem>
153+
<MenuItem key='2'>Chats</MenuItem>
154+
<MenuItem key='3'>Settings</MenuItem>
155+
</MenuV2>
156+
</OptionMenu>
157+
</Option>
158+
</>
159+
);
160+
130161
export const WithIcon: StoryFn<typeof Option> = () => (
131162
<>
132163
<Option onClick={action('click')}>

packages/fuselage/src/components/Option/Option.styles.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ $variants: (
8585
height: 100%;
8686

8787
opacity: 0;
88+
89+
&:has(> [aria-expanded='true']) {
90+
width: lengths.size(28);
91+
92+
opacity: 1;
93+
}
8894
}
8995

9096
&__column {

0 commit comments

Comments
 (0)