fix: simplify window.matchMedia (#1359)
There is really no reason to call window.matchMedia instead of just matchMedia.
This commit is contained in:
parent
6c58052684
commit
467eb85209
|
@ -149,7 +149,8 @@
|
||||||
"DOMParser",
|
"DOMParser",
|
||||||
"CSS",
|
"CSS",
|
||||||
"customElements",
|
"customElements",
|
||||||
"AbortController"
|
"AbortController",
|
||||||
|
"matchMedia"
|
||||||
],
|
],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|
|
@ -7,9 +7,9 @@ export function resizeObservers (store) {
|
||||||
|
|
||||||
const recalculateIsMobileSize = () => {
|
const recalculateIsMobileSize = () => {
|
||||||
store.set({
|
store.set({
|
||||||
isMobileSize: window.matchMedia('(max-width: 767px)').matches, // e.g. iPhone Plus
|
isMobileSize: matchMedia('(max-width: 767px)').matches, // e.g. iPhone Plus
|
||||||
isSmallMobileSize: window.matchMedia('(max-width: 479px)').matches, // e.g. Galaxy S5
|
isSmallMobileSize: matchMedia('(max-width: 479px)').matches, // e.g. Galaxy S5
|
||||||
isTinyMobileSize: window.matchMedia('(max-width: 320px)').matches // e.g. iPhone 4
|
isTinyMobileSize: matchMedia('(max-width: 320px)').matches // e.g. iPhone 4
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ const persistedState = {
|
||||||
pushSubscriptions: {},
|
pushSubscriptions: {},
|
||||||
reduceMotion:
|
reduceMotion:
|
||||||
!process.browser ||
|
!process.browser ||
|
||||||
window.matchMedia('(prefers-reduced-motion: reduce)').matches,
|
matchMedia('(prefers-reduced-motion: reduce)').matches,
|
||||||
underlineLinks: false
|
underlineLinks: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// should be kept in sync with global.scss
|
// should be kept in sync with global.scss
|
||||||
export function getMainTopMargin () {
|
export function getMainTopMargin () {
|
||||||
if (window.matchMedia('(max-width: 767px)').matches) {
|
if (matchMedia('(max-width: 767px)').matches) {
|
||||||
return 62
|
return 62
|
||||||
} else if (window.matchMedia('(max-width: 991px').matches) {
|
} else if (matchMedia('(max-width: 991px').matches) {
|
||||||
return 52
|
return 52
|
||||||
} else {
|
} else {
|
||||||
return 42
|
return 42
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const prefersDarkTheme = process.browser && window.matchMedia('(prefers-color-scheme: dark)').matches
|
const prefersDarkTheme = process.browser && matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
const meta = process.browser && document.getElementById('theThemeColor')
|
const meta = process.browser && document.getElementById('theThemeColor')
|
||||||
|
|
||||||
export const INLINE_THEME = 'default' // theme that does not require external CSS
|
export const INLINE_THEME = 'default' // theme that does not require external CSS
|
||||||
|
|
Loading…
Reference in New Issue