Skip to content

Commit

Permalink
fix: correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
thebiltheory committed Apr 27, 2020
1 parent d920a2c commit 8d2bdfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# useBreakpoints

> React Hook to map value/breakpoint the styled-component way.
[![CircleCI](https://circleci.com/gh/thebiltheory/useBreakpoints/tree/master.svg?style=svg)](https://circleci.com/gh/thebiltheory/useBreakpoints/tree/master) [![NPM](https://img.shields.io/npm/v/usebreakpoints.svg)](https://www.npmjs.com/package/@thebiltheory/usebreakpoints) ![npm](https://img.shields.io/npm/v/@thebiltheory/usebreakpoints?color=%236820FE) ![npm](https://img.shields.io/npm/dm/@thebiltheory/usebreakpoints)

React Hook to map value/breakpoint the styled-component way.

## Example/ Demo

[![Edit useBreakpoints](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/amazing-edison-x9g17?fontsize=14&hidenavigation=1&theme=dark)
Expand All @@ -24,14 +24,20 @@ yarn add @thebiltheory/usebreakpoints

```tsx
const [value, currentBreakpoint] = useBreakpoints(
['sad', 'neutral', 'happy', 'rocket'],
[576, 768, 992, 1200]
['mobile', 'tablet', 'desktop', 'huge screen'],
[576, 768, 992, 1600]
)

const [value, currentBreakpoint] = useBreakpoints(
[1, 2, 3, 4],
[576, 768, 992, 1200]
)

import theme from 'src/theme'
const [value, currentBreakpoint] = useBreakpoints(
[1, 2, 3, 4],
theme.breakpoints
)
```

## License
Expand Down
2 changes: 1 addition & 1 deletion src/utils/makeMediaQueryList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function getMediaQueriyList(breakpoints: number[]) {
export default function makeMediaQueryList(breakpoints: number[]) {
return breakpoints.map((breakpoint: number, index: number) => {
const maxWidth = breakpoints[index + 1]
return window.matchMedia(
Expand Down

0 comments on commit 8d2bdfa

Please sign in to comment.