|
| 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 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 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 | + |
0 commit comments