react-responsive-tools 2.3.16 → 2.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,15 @@
|
|
1
1
|
import { useMediaQuery } from 'react-responsive';
|
2
2
|
import useVariant from './useVariant.js';
|
3
3
|
import getBreakpoint from "../functions/getBreakpoint.js";
|
4
|
-
import { useMemo } from "react";
|
5
4
|
export default function useBreakpoint(b, variant = 'MtF') {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return useMediaQuery({ query: `(${v}-width: ${_bp})` });
|
11
|
-
}, [variant, b]);
|
5
|
+
const _bp = typeof b === 'number' ? b + 'px' : getBreakpoint(b);
|
6
|
+
const v = useVariant(variant);
|
7
|
+
console.log('useMediaQuery', _bp, `(${v}-width: ${_bp})`);
|
8
|
+
return useMediaQuery({ query: `(${v}-width: ${_bp})` });
|
12
9
|
}
|
13
10
|
export function useBreakpointMF(b) {
|
14
11
|
return useBreakpoint(b, 'MtF');
|
15
12
|
}
|
16
13
|
export function useBreakpointDF(b) {
|
17
|
-
return useBreakpoint(b, '
|
14
|
+
return useBreakpoint(b, 'DtF');
|
18
15
|
}
|
@@ -1,17 +1,14 @@
|
|
1
1
|
import { useMediaQuery } from 'react-responsive';
|
2
2
|
import useVariant from './useVariant.js';
|
3
3
|
import { getVBreakpoint } from "../functions/getBreakpoint.js";
|
4
|
-
import { useMemo } from "react";
|
5
4
|
export default function useVBreakpoint(b, variant = 'MtF') {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
return useMediaQuery({ query: `(${v}-height: ${_bp})` });
|
10
|
-
}, [b, variant]);
|
5
|
+
const _bp = typeof b === 'number' ? b + 'px' : getVBreakpoint(b);
|
6
|
+
const v = useVariant(variant);
|
7
|
+
return useMediaQuery({ query: `(${v}-height: ${_bp})` });
|
11
8
|
}
|
12
9
|
export function useVBreakpointMF(b) {
|
13
10
|
return useVBreakpoint(b, 'MtF');
|
14
11
|
}
|
15
12
|
export function useVBreakpointDF(b) {
|
16
|
-
return useVBreakpoint(b, '
|
13
|
+
return useVBreakpoint(b, 'DtF');
|
17
14
|
}
|