Skip to content

Commit 468a66b

Browse files
authored
[Calling] Reaction mobile view button animations (#4252)
1 parent 1f84011 commit 468a66b

18 files changed

+310
-25
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "feature",
4+
"workstream": "Reaction",
5+
"comment": "[Calling] Reaction mobile view buttons (#4260)",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "improvement",
4+
"workstream": "Componentize the mobile view reaction button",
5+
"comment": "Componentizing the reaction button for mobile view",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "improvement",
4+
"workstream": "Add mobile view reactions for drawer menu",
5+
"comment": "Reaction mobile view button animations",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "improvement",
4+
"workstream": "removing unwanted dependency",
5+
"comment": "Reaction mobile button PR feedback",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "improvement",
4+
"workstream": "Reactions",
5+
"comment": "CC refactor and UI styles unit update",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "feature",
4+
"workstream": "Reactions",
5+
"comment": "Componentizing the reaction button for mobile view",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "improvement",
4+
"workstream": "Knit pick",
5+
"comment": "Reaction mobile view button animations",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}

packages/react-components/review/beta/react-components.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ export interface _DrawerMenuItemProps {
10311031
itemKey: string;
10321032
// (undocumented)
10331033
onItemClick?: (ev?: React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement>, itemKey?: string) => void;
1034+
onRendererContent?: () => JSX.Element;
10341035
secondaryComponent?: JSX.Element;
10351036
secondaryIconProps?: IIconProps;
10361037
secondaryText?: string;
@@ -1937,6 +1938,16 @@ export interface ReactionButtonStrings {
19371938
tooltipDisabledContent?: string;
19381939
}
19391940

1941+
// @internal
1942+
export const _ReactionDrawerMenuItem: (props: _ReactionMenuItemProps) => JSX.Element;
1943+
1944+
// @internal
1945+
export interface _ReactionMenuItemProps {
1946+
disabled?: boolean;
1947+
onReactionClick?: (reaction: string) => Promise<void>;
1948+
reactionResources?: ReactionResources;
1949+
}
1950+
19401951
// @beta
19411952
export interface ReactionResources {
19421953
applauseReaction?: ReactionSprite;

packages/react-components/review/stable/react-components.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ export interface _DrawerMenuItemProps {
801801
itemKey: string;
802802
// (undocumented)
803803
onItemClick?: (ev?: React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement>, itemKey?: string) => void;
804+
onRendererContent?: () => JSX.Element;
804805
secondaryComponent?: JSX.Element;
805806
secondaryIconProps?: IIconProps;
806807
secondaryText?: string;

packages/react-components/src/components/Drawer/DrawerMenu.tsx

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export interface _DrawerMenuProps {
4646
styles?: _DrawerMenuStyles;
4747
}
4848

49+
const isDrawerMenuItem = (item: _DrawerMenuItemProps): boolean => {
50+
return item.onRendererContent === undefined;
51+
};
52+
4953
/**
5054
* Takes a set of menu items and returns a created menu inside a {@link _DrawerSurface}.
5155
*
@@ -61,7 +65,7 @@ export const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {
6165
const menuItemsToRender = useMemo(() => {
6266
let items: _DrawerMenuItemProps[] | undefined = props.items;
6367
for (const subMenuKey of selectedKeyPath) {
64-
items = items?.find((item) => item.itemKey === subMenuKey)?.subMenuProps;
68+
items = items?.find((item) => isDrawerMenuItem(item) && item.itemKey === subMenuKey)?.subMenuProps;
6569
}
6670
return items;
6771
}, [props.items, selectedKeyPath]);
@@ -85,7 +89,7 @@ export const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {
8589

8690
// Ensure the first item has a border radius that matches the DrawerSurface
8791
const borderRadius = useTheme().effects.roundedCorner4;
88-
const firstItemStyle = menuItemsToRender && menuItemsToRender[0]?.styles;
92+
const firstItemStyle = menuItemsToRender?.[0] && menuItemsToRender[0]?.styles;
8993
const modifiedFirstItemStyle = useMemo(
9094
() =>
9195
merge(firstItemStyle ?? {}, {
@@ -105,26 +109,38 @@ export const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {
105109
heading={props.heading}
106110
>
107111
<Stack styles={props.styles} role="menu" data-ui-id="drawer-menu">
108-
{menuItemsToRender?.slice(0, 1).map((item) => (
109-
<DrawerMenuItem
110-
{...item}
111-
key={`${item.itemKey}` + '0'}
112-
shouldFocusOnMount={true}
113-
styles={modifiedFirstItemStyle}
114-
onItemClick={(ev, itemKey) => {
115-
onItemClick(item, ev, itemKey);
116-
}}
117-
/>
118-
))}
119-
{menuItemsToRender?.slice(1).map((item, i) => (
120-
<DrawerMenuItem
121-
{...item}
122-
key={`${item.itemKey}` + `${i + 1}`}
123-
onItemClick={(ev, itemKey) => {
124-
onItemClick(item, ev, itemKey);
125-
}}
126-
/>
127-
))}
112+
{menuItemsToRender?.slice(0, 1).map((item) =>
113+
isDrawerMenuItem(item) ? (
114+
<DrawerMenuItem
115+
{...item}
116+
key={`${item.itemKey}` + '0'}
117+
shouldFocusOnMount={item.itemKey === 'reactions' ? false : true}
118+
styles={modifiedFirstItemStyle}
119+
onItemClick={
120+
item.itemKey === 'reactions'
121+
? undefined
122+
: (ev, itemKey) => {
123+
onItemClick(item, ev, itemKey);
124+
}
125+
}
126+
/>
127+
) : (
128+
item.onRendererContent?.()
129+
)
130+
)}
131+
{menuItemsToRender?.slice(1).map((item, i) =>
132+
isDrawerMenuItem(item) ? (
133+
<DrawerMenuItem
134+
{...item}
135+
key={`${item.itemKey}` + `${i + 1}`}
136+
onItemClick={(ev, itemKey) => {
137+
onItemClick(item, ev, itemKey);
138+
}}
139+
/>
140+
) : (
141+
item.onRendererContent?.()
142+
)
143+
)}
128144
</Stack>
129145
</_DrawerSurface>
130146
);

0 commit comments

Comments
 (0)