Replace SidebarPinStateContext with versioned provider and hook.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-05-20 15:23:39 +02:00
parent 3533075dfd
commit da72da5dae
15 changed files with 208 additions and 70 deletions
@@ -14,11 +14,11 @@
* limitations under the License.
*/
import { useCallback, useContext, useMemo } from 'react';
import { useCallback, useMemo } from 'react';
import { useTheme } from '@material-ui/core';
import { SidebarPinStateContext } from '@backstage/core-components';
import { useSidebarPinState } from '@backstage/core-components';
import { BackstageTheme } from '@backstage/theme';
import { Transformer } from '../transformer';
@@ -27,7 +27,7 @@ import { rules } from './rules';
/**
* Sidebar pinned state to be used in computing style injections.
*/
const useSidebar = () => useContext(SidebarPinStateContext);
const useSidebar = () => useSidebarPinState();
/**
* Process all rules and concatenate their definitions into a single style.