@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
31 lines • 1.19 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React, { createContext, useContext } from 'react';
/**
* Context for side pane interaction
*
* @private
*/
export const SidePaneContext = createContext({});
/**
* Provider to provide localized strings for this library's composites.
*
* @private
*/
export const SidePaneProvider = (props) => {
return React.createElement(SidePaneContext.Provider, { value: props }, props.children);
};
/** @private */
export const useSidePaneContext = () => useContext(SidePaneContext);
/** @private */
export const useIsSidePaneOpen = () => {
const { sidePaneRenderer, overrideSidePane } = useSidePaneContext();
return !!(sidePaneRenderer || (overrideSidePane === null || overrideSidePane === void 0 ? void 0 : overrideSidePane.isActive));
};
/** @private */
export const useIsParticularSidePaneOpen = (sidePaneId) => {
const isSidePaneOpen = useIsSidePaneOpen();
const { sidePaneRenderer } = useSidePaneContext();
return isSidePaneOpen && (sidePaneRenderer === null || sidePaneRenderer === void 0 ? void 0 : sidePaneRenderer.id) === sidePaneId;
};
//# sourceMappingURL=SidePaneProvider.js.map