export const getBreakpointIndex = ( { width , breakpoints , } ) => { const breakpointPixels = [ ... breakpoints ] . reverse ( ) . find ( ( breakpoint ) => width >= breakpoint ) ; let breakpointIndex = breakpoints . findIndex ( ( breakpoint ) => breakpointPixels === breakpoint ) ; breakpointIndex = breakpointIndex === - 1 ? 0 : breakpointIndex + 1 ; return breakpointIndex ; } ;