All files / Components SidebarWrapper.js

100% Statements 9/9
100% Branches 4/4
100% Functions 2/2
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32        1x     29x   28x 28x   28x 28x 1x       28x   28x                      
import React, { useContext, useEffect } from 'react';
import { WebAppsUXContext } from '../Context';
import Scrollbar from './Scrollbar';
 
const SidebarWrapper = props => {
    const {
        children,
    } = props;
 
    const { useNavigation } = useContext(WebAppsUXContext);
    const { navigation } = useNavigation;
 
    useEffect(() => {
        if (navigation.menu && navigation.menu.error) {
            throw new Error(navigation.menu.message);
        }
    }, [navigation]);
 
    const isRtl = getComputedStyle(document.querySelector('html')).direction === 'rtl';
 
    return (
        <Scrollbar
            settings={{ suppressScrollX: !isRtl }}
            tag="div"
            className={`flex flex-col flex-grow h-full px-3 mt-6 mb-4`}
        >
            {children}
        </Scrollbar>
    )
}
 
export default SidebarWrapper;