Breakpoints
Installation
$ yarn add @rexlabs/breakpoints
Usage
import { useMediaQuery, Breakpoints } from '@rexlabs/box';
Upgrade Guide
Version 1.x to 2.0.0
Updated components
Breakpoints- The API for this component has been updated- Removed
mobile,tablet, anddesktopprops - Added a
queriesprop that configures the breakpoints that we want - Added a
noRenderprop that whentruewill stop this component from rendering anything, when false we will wrap the component in adivthat setsdisplay: noneat the breakpoints where it shouldn't be visible
- Removed
BreakpointProvider- TheBreakpointProviderhas been removed- Each media query is now created on the fly with
useMediaQueryinstead of having 3 specific breakpoints that are not able to be changed
- Each media query is now created on the fly with
Updated hooks
useBreakpoint- RemoveduseMediaQuery- This is a new hook that will create a media query based on thequeriesthat you pass into it- This is much less restrictive and will eventually allow us to be able to add more complex media queries
Updated types
Query- Defines what we can currently use to create media queries
interface Query {
minWidth?: number | TokenKeys;
maxWidth?: number | TokenKeys;
}
Legal
Copyright © 2021 Rex Software All Rights Reserved.