Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Vincze committed Apr 21, 2021
1 parent f435258 commit c550090
Show file tree
Hide file tree
Showing 35 changed files with 229 additions and 289 deletions.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,23 @@ npm i @w11r/use-breakpoint

# Setup

By default you don't need to do anything. The following default values
are being used. It also shorthands.
## Add provider

Add `BreakpointProvider` in your React tree.

```jsx
import { BreakpointProvider } from '@w11r/use-breakpoint'

...
<BreakpointProvider>
...
</BreakpointProvider>
...
```

## Default breakpoints

The following default breakpoints are being used, including several shorthands.

```js
const breakpoints = {
Expand Down Expand Up @@ -66,13 +81,12 @@ useBreakpoint(defaultValue, breakpointValues)
['tablet', 400]
]

// In case you have a single breakpoint value, `['mobile', 300]`
is enough instead of `[['mobile', 300]]`
// In case you have a single breakpoint value, `['mobile', 300]` is enough instead of `[['mobile', 300]]`
```

## Without passing values

In case you dont specify any value to the hook, it'll return a generated
In case you don't specify any value to the hook, it'll return a generated
object including boolean values for each breakpoint keys that's being
defined in options.

Expand Down Expand Up @@ -148,7 +162,7 @@ const { isMobile } = useBreakpoint()
const isMobile = useBreakpoint(false, ['mobile', true])
```

> You can also access the values with suffix and prefix but you need
> You can also access the values with suffix and prefix, but you need
> to rename the variables because it contains invalid character:
> `const { 'isMobile+': isMobile } = useBreakpoint()`
Expand Down Expand Up @@ -250,7 +264,8 @@ mediaQuery([')', 'content'])
## Is there any best practice suggestion?

Yes! Use as fewer hooks as possible. It's always faster to have a single
`isMobile` variable and have simple conditions based on it.
`isMobile` variable and have simple conditions based on it. It's even better
if you can solve your size related cases using pure CSS Media Queries.

## Why not using an `Object`? Why the `Array` structure?

Expand Down
2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@



window['FRAMEWORK_OPTIONS'] = {};</script><script src="runtime~main.47ae25361c658c1ec8ae.bundle.js"></script><script src="vendors~main.47ae25361c658c1ec8ae.bundle.js"></script><script src="main.47ae25361c658c1ec8ae.bundle.js"></script></body></html>
window['FRAMEWORK_OPTIONS'] = {};</script><script src="runtime~main.ed6b6fed4ea65daeaf50.bundle.js"></script><script src="vendors~main.ed6b6fed4ea65daeaf50.bundle.js"></script><script src="main.ed6b6fed4ea65daeaf50.bundle.js"></script></body></html>
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@



window['DOCS_MODE'] = false;</script><script src="runtime~main.870e8ee0658e83d05c6b.bundle.js"></script><script src="vendors~main.7cb89eef6fb5a60e11f4.bundle.js"></script><script src="main.a318f7d1a457ea4efb38.bundle.js"></script></body></html>
window['DOCS_MODE'] = false;</script><script src="runtime~main.870e8ee0658e83d05c6b.bundle.js"></script><script src="vendors~main.41c7967d96e28384f661.bundle.js"></script><script src="main.ecfb7176d7b1ca4a916e.bundle.js"></script></body></html>
2 changes: 0 additions & 2 deletions docs/main.47ae25361c658c1ec8ae.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/main.47ae25361c658c1ec8ae.bundle.js.map

This file was deleted.

1 change: 0 additions & 1 deletion docs/main.a318f7d1a457ea4efb38.bundle.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/main.ecfb7176d7b1ca4a916e.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c550090

Please sign in to comment.