Skip to content

Commit c2a0968

Browse files
New control Hover reactions bar (#1652)
* new control HoverReactionsBar * commit changes log * Update HoverReactionsBar.md * commit changes --------- Co-authored-by: Joel Rodrigues <[email protected]>
1 parent c6ec162 commit c2a0968

24 files changed

+46908
-116
lines changed
103 KB
Loading
110 KB
Loading
367 KB
Loading
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# HoverReactionsBar
2+
3+
This control allows you to select an emoji from emoji bar or select from picker.
4+
5+
6+
**HoverReactionsBar**
7+
8+
![hoverReactions3Bar](../assets/hoverReactions3Bar.png)
9+
10+
![hoverReactionsBar2](../assets/hoverReactionsBar2.png)
11+
12+
![hoverReactionsBar1](../assets/hoverReactionsBar1.png)
13+
14+
15+
## How to use this control in your solutions
16+
17+
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency.
18+
- Import the following modules to your component:
19+
20+
```TypeScript
21+
import { HoverReactionsBar } from '@pnp/spfx-controls-react/lib/HoverReactionsBar';
22+
```
23+
24+
- Use the `HoverReactionsBar` control in your code as follows:
25+
26+
```TypeScript
27+
<HoverReactionsBar
28+
isOpen={isOpenHoverReactionBar}
29+
onSelect={onSelectEmoji}
30+
onDismiss={(): void => {
31+
setIsOpenHoverReactionBar(false);
32+
}}
33+
target={divRefAddReaction.current as HTMLDivElement}
34+
/>
35+
```
36+
37+
- With the `onSelect` property you can get the selected emoji:
38+
39+
```typescript
40+
const onSelectEmoji = React.useCallback(async (emoji: string, emojiInfo: IEmojiInfo) => {
41+
console.log('emoji', emoji);
42+
console.log('emojiInfo object',emojiInfo);
43+
setIsOpenHoverReactionBar(false);
44+
}, []);
45+
46+
```
47+
onSelect: (emoji: string | undefined, emojiInfo?: IEmojiInfo) => void;
48+
isOpen: boolean;
49+
onDismiss: () => void;
50+
top4Reactions?: string[];
51+
target: HTMLDivElement;
52+
themeV8?: Theme ;
53+
54+
## Implementation
55+
56+
The HoverReactionsBar control can be configured with the following properties:
57+
58+
| Property | Type | Required | Description |
59+
| ---- | ---- | ---- | ---- |
60+
| isOpen | boolean | yes | show hoverReactionsVar |
61+
| onSelected |onSelect: (emoji: string, emojiInfo?: IEmojiInfo) => void;| yes | selected Emoji |
62+
| top4Reactions | string[] | no | name of emojis to show on the bar |
63+
| target | HTMLDivElement | yes | container of controls who fire the HoverReactionsBar |
64+
| onDismis | onDismiss: () => void; | yes | function to call to dismiss HoverReactionsBar|
65+
| themeV8 | Theme | No | Set Fluent UI Theme|
66+
67+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/HoverReactionsBar)

0 commit comments

Comments
 (0)