Skip to content

Commit 17fbeae

Browse files
committed
chores:
- add custom media query utility with js - update readme
1 parent dbfec84 commit 17fbeae

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- :chart_with_upwards_trend: Redux and Redux Saga but with less boilerplate
2424
- Redux Toolkit configured with React Redux and Redux Saga for very little boilerplate
2525
- React Redux Hooks used for even more clean code
26+
- React Persist configured for easier localstorage integration
2627
- :blue_heart: Ant Design
2728
- Configurable Ant theme variables out of the box
2829
- Localized Ant Design Component for better multilingual support
@@ -66,8 +67,6 @@ $ yarn build
6667

6768
```
6869

69-
Note: If you're using Linux Bash for Windows, [see this guide](https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/) or use `node` from the command prompt.
70-
7170
## Credits
7271

7372
This software uses the following open source packages:
@@ -79,7 +78,7 @@ This software uses the following open source packages:
7978
- [Redux Saga](https://redux-saga.js.org/)
8079
- [React Intl](https://formatjs.io/docs/react-intl/)
8180
- [React Router](https://reactrouter.com/)
82-
- [React Router](https://www.axios.com/)
81+
- [Axios](https://www.axios.com/)
8382
- And more..
8483

8584
## License

src/styles/utilities/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { breakpoints, media, isScreenSize } from './media-query';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// MEDIA QUERY WITH JS ;)
2+
export const breakpoints = {
3+
xs: 480,
4+
sm: 576,
5+
md: 768,
6+
lg: 992,
7+
xl: 1200,
8+
xxl: 1600,
9+
};
10+
export const media = key => style =>
11+
`@media (${key === 'xs' || key === 'sm' ? 'max-width' : 'min-width'}: ${
12+
breakpoints[key]
13+
}px) { ${style} }`;
14+
15+
export const isScreenSize = key => {
16+
if (key === 'xs' || key === 'sm') {
17+
return window.innerWidth <= breakpoints[key];
18+
}
19+
20+
return window.innerWidth >= breakpoints[key];
21+
};

0 commit comments

Comments
 (0)