@atlaskit/app-provider
Version:
A top level provider for the Design System.
23 lines (22 loc) • 853 B
JavaScript
import { useEffect } from 'react';
import { getDocument } from '@atlaskit/browser-apis';
import { fg } from '@atlaskit/platform-feature-flags/fg';
import { installScrollbarHarmonisation } from './install-scrollbar-harmonisation';
/**
* Activates the harmonised scrollbar appearance. An explicit value overrides the shared rollout
* gate; when omitted, the shared gate controls the appearance.
*/
export function useScrollbarHarmonisation(isEnabled) {
var isGateEnabled = fg('platform_dst_scrollbar_harmonisation');
var shouldEnable = isEnabled !== null && isEnabled !== void 0 ? isEnabled : isGateEnabled;
useEffect(function () {
if (!shouldEnable) {
return;
}
var targetDocument = getDocument();
if (!targetDocument) {
return;
}
return installScrollbarHarmonisation(targetDocument);
}, [shouldEnable]);
}