feat: screen presentation and dismiss animations for mobile (#2073)

This commit is contained in:
Mo
2022-11-30 14:37:36 -06:00
committed by GitHub
parent 0e95b451d6
commit 7f2074a6ec
79 changed files with 1338 additions and 878 deletions

View File

@@ -205,9 +205,12 @@ export const disableIosTextFieldZoom = () => {
}
export const isMobileScreen = () => !window.matchMedia(MediaQueryBreakpoints.md).matches
export const isTabletScreen = () =>
!window.matchMedia(MediaQueryBreakpoints.sm).matches && !window.matchMedia(MediaQueryBreakpoints.lg).matches
export const isTabletOrMobileScreen = () => isMobileScreen() || isTabletScreen()
export const getBase64FromBlob = (blob: Blob) => {
return new Promise<string>((resolve, reject) => {
const reader = new FileReader()

View File

@@ -1,20 +0,0 @@
import { focusModeAnimationDuration } from '../Components/QuickSettingsMenu/QuickSettingsMenu'
export const FOCUS_MODE_CLASS_NAME = 'focus-mode'
export const DISABLING_FOCUS_MODE_CLASS_NAME = 'disable-focus-mode'
export const toggleFocusMode = (enabled: boolean) => {
if (enabled) {
document.body.classList.add(FOCUS_MODE_CLASS_NAME)
return
}
if (document.body.classList.contains(FOCUS_MODE_CLASS_NAME)) {
document.body.classList.add(DISABLING_FOCUS_MODE_CLASS_NAME)
document.body.classList.remove(FOCUS_MODE_CLASS_NAME)
setTimeout(() => {
document.body.classList.remove(DISABLING_FOCUS_MODE_CLASS_NAME)
}, focusModeAnimationDuration)
}
}