0.0.212 • Published 3 years ago

ui-breakpoint v0.0.212

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

UiBreakpoint

A simple, configurable breakpoint class for any Web project.

Features ✨

  • Optimized for perfomance (uses media queries).
  • Works with any JavaScript project.
  • Add multiple defined breakpoints eg sm, mobile, etc.
  • Supports orientation.

Config ⚙

The UiBreakpoint requires a single object as an argument when initializing. The properties are listed below.

Example 💁‍♀️

const screenSizes = {
  xxs: 0,
  xs: 320,
  sm: 560,
  md: 960,
  lg: 1020,
  xl: 1920
}  

const breakpoint = new UiBreakpoint({
  config: screenSizes,
  useOrientation: true,
  onChange: e => {
    const isMobile = /xxs|xs|sm/.test(e.is);
    
    if(e.orientation == 'landscape' && isMobile){
      alert('Only portrait mode supported!')
    } 
    
    // this is where you update your store to have the breakpoint globally accessible
    // for framework lovers only.
  }  
})

Actually, thats all about the breakpoint API.

Ciao 👋

0.0.209

3 years ago

0.0.208

3 years ago

0.0.212

3 years ago

0.0.211

3 years ago

0.0.210

3 years ago

0.0.205

3 years ago

0.0.204

3 years ago

0.0.203

3 years ago

0.0.202

3 years ago

0.0.207

3 years ago

0.0.206

3 years ago

0.0.201

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago