Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web/satellite: VBar, VBanner migrated to use composition api
composables folder created (same as react hooks) for functionality reusage; related test moved to ignored folder; Change-Id: I494aa27079aa5694bee7b18511eeadd56ced59e9
- Loading branch information
1 parent
870eefb
commit 235e9be
Showing
5 changed files
with
99 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2022 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
import { computed, onMounted, onUnmounted, ref } from 'vue'; | ||
|
||
export function useResize() { | ||
const screenWidth = ref<number>(window.innerWidth); | ||
const screenHeight = ref<number>(window.innerHeight); | ||
|
||
const isMobile = computed((): boolean => { | ||
return screenWidth.value <= 550; | ||
}); | ||
|
||
const isTablet = computed((): boolean => { | ||
return !isMobile.value && screenWidth.value <= 800; | ||
}); | ||
|
||
function onResize(): void { | ||
screenWidth.value = window.innerWidth; | ||
screenHeight.value = window.innerHeight; | ||
} | ||
|
||
onMounted((): void => { | ||
window.addEventListener('resize', onResize); | ||
}); | ||
|
||
onUnmounted((): void => { | ||
window.removeEventListener('resize', onResize); | ||
}); | ||
|
||
return { | ||
screenWidth, | ||
screenHeight, | ||
isMobile, | ||
isTablet, | ||
}; | ||
} |
13 changes: 0 additions & 13 deletions
13
web/satellite/tests/unit/common/__snapshots__/VBar.spec.ts.snap
This file was deleted.
Oops, something went wrong.
File renamed without changes.