Commit c283428a authored by Martin Wortschack's avatar Martin Wortschack Committed by Kushal Pandya

Replace breakpoints with GlBreakpointInstance in fly_out_nav.js

parent ded5cdcb
import bp from './breakpoints'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { SIDEBAR_COLLAPSED_CLASS } from './contextual_sidebar'; import { SIDEBAR_COLLAPSED_CLASS } from './contextual_sidebar';
const HIDE_INTERVAL_TIMEOUT = 300; const HIDE_INTERVAL_TIMEOUT = 300;
...@@ -40,10 +40,7 @@ export const canShowActiveSubItems = el => { ...@@ -40,10 +40,7 @@ export const canShowActiveSubItems = el => {
return true; return true;
}; };
export const canShowSubItems = () => export const canShowSubItems = () => ['md', 'lg', 'xl'].includes(bp.getBreakpointSize());
bp.getBreakpointSize() === 'sm' ||
bp.getBreakpointSize() === 'md' ||
bp.getBreakpointSize() === 'lg';
export const getHideSubItemsInterval = () => { export const getHideSubItemsInterval = () => {
if (!currentOpenMenu || !mousePos.length) return 0; if (!currentOpenMenu || !mousePos.length) return 0;
......
import { GlBreakpointInstance } from '@gitlab/ui/dist/utils';
import { import {
calculateTop, calculateTop,
showSubLevelItems, showSubLevelItems,
...@@ -15,7 +16,6 @@ import { ...@@ -15,7 +16,6 @@ import {
subItemsMouseLeave, subItemsMouseLeave,
} from '~/fly_out_nav'; } from '~/fly_out_nav';
import { SIDEBAR_COLLAPSED_CLASS } from '~/contextual_sidebar'; import { SIDEBAR_COLLAPSED_CLASS } from '~/contextual_sidebar';
import bp from '~/breakpoints';
describe('Fly out sidebar navigation', () => { describe('Fly out sidebar navigation', () => {
let el; let el;
...@@ -26,7 +26,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -26,7 +26,7 @@ describe('Fly out sidebar navigation', () => {
el.style.position = 'relative'; el.style.position = 'relative';
document.body.appendChild(el); document.body.appendChild(el);
spyOn(bp, 'getBreakpointSize').and.callFake(() => breakpointSize); spyOn(GlBreakpointInstance, 'getBreakpointSize').and.callFake(() => breakpointSize);
setOpenMenu(null); setOpenMenu(null);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment