1.8.0 • Published 2 years ago

@s-ui/react-layout-breakpoint-split v1.8.0

Weekly downloads
23
License
MIT
Repository
-
Last release
2 years ago

LayoutBreakpointSplit

Show or hide views according to the breakpoint.

Installation

$ npm install @s-ui/react-layout-breakpoint-split --save

Usage

Basic usage

import LayoutBreakpointSplit from '@s-ui/react-layout-breakpoint-split'

setView(current) {
  this.setState({current})
}

const current = this.state && this.state.current || 0

return (<div>
<LayoutBreakpointSplit breakpoint={575} current={current}>
  <div>
    LEFT VIEW {current == 0 && '(active)'}
    <button onClick={this.setView.bind(this, 1)}>Next &gt;</button>
  </div>

  <div>
    RIGHT VIEW {current == 1 && '(active)'}
    <button onClick={this.setView.bind(this, 0)}>Prev &lt;</button>
  </div>
</LayoutBreakpointSplit>
</div>)