All files breakpoints.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 5/5

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    2x         2x       21x 65x 21x        
export type Breakpoints = number[];
 
export const defaultBreakpoints: Breakpoints = [0, 540, 768, 1084, 1400, 1779];
 
/**
 * Identifies current breakpoint based on window width
 */
export function identifyBreakpoint(
    windowWidth: number,
    breakpoints: Breakpoints
): number {
    for (let breakpoint: number = breakpoints.length - 1; breakpoint >= 0; breakpoint--) {
        if (windowWidth >= breakpoints[breakpoint]) {
            return breakpoint;
        }
    }
}