UNPKG

azure-devops-ui

Version:

React components for building web UI in Azure DevOps

1 lines 905 B
import"../../CommonImports";import"../../Core/core.css";import"./Breakpoint.css";import*as React from"react";import{Intersection}from"../../Intersection";function Breakpoint(o){for(var a=React.useState(function(){return React.createRef()})[0],i=-2,e=o.breakpoints,t=e[e.length-1]+1,r=[],n=0;n<e.length;n++)r[3*n]=(e[n]-1)/t,r[3*n+1]=e[n]/t,r[3*n+2]=(e[n]+1)/t;return React.createElement("div",{className:"bolt-breakpoint relative"},React.createElement(Intersection,{observationElement:function(){return a.current},onIntersect:function(){for(var e=a.current.parentElement.clientWidth,t=o.breakpoints,r=o.onBreakpoint,n=t.length-1;0<=n&&!(e>=t[n]);n--);n!==i&&r(i=n,t[n])},threshold:r},React.createElement("div",{className:"bolt-breakpoint-container absolute-fill scroll-hidden"},React.createElement("div",{className:"bolt-breakpoint-observation absolute",ref:a,style:{width:t+"px"}}))))}export{Breakpoint};