refactor(client): use dvh

This commit is contained in:
syuilo 2022-11-13 11:43:23 +09:00
parent 1751bfea5f
commit 831be69cec
6 changed files with 9 additions and 28 deletions

View file

@ -82,16 +82,6 @@ import { getAccountFromId } from '@/scripts/get-account-from-id';
else location.reload(); else location.reload();
}); });
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
// TODO: いつの日にか消したい
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
window.addEventListener('resize', () => {
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
});
//#endregion
// If mobile, insert the viewport meta tag // If mobile, insert the viewport meta tag
if (['smartphone', 'tablet'].includes(deviceKind)) { if (['smartphone', 'tablet'].includes(deviceKind)) {
const viewport = document.getElementsByName('viewport').item(0); const viewport = document.getElementsByName('viewport').item(0);

View file

@ -168,8 +168,7 @@ function more(ev: MouseEvent) {
left: 0; left: 0;
z-index: 1001; z-index: 1001;
width: $nav-icon-only-width; width: $nav-icon-only-width;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;
overflow-x: clip; overflow-x: clip;

View file

@ -198,8 +198,7 @@ onMounted(() => {
$ui-font-size: 1em; $ui-font-size: 1em;
$widgets-hide-threshold: 1200px; $widgets-hide-threshold: 1200px;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ min-height: 100dvh;
min-height: calc(var(--vh, 1vh) * 100);
box-sizing: border-box; box-sizing: border-box;
&.wallpaper { &.wallpaper {
@ -301,8 +300,7 @@ onMounted(() => {
top: 0; top: 0;
right: 0; right: 0;
z-index: 1001; z-index: 1001;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
padding: var(--margin); padding: var(--margin);
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;

View file

@ -255,8 +255,7 @@ async function deleteProfile() {
--deckDividerThickness: 5px; --deckDividerThickness: 5px;
display: flex; display: flex;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
@ -424,8 +423,7 @@ async function deleteProfile() {
top: 0; top: 0;
left: 0; left: 0;
z-index: 1001; z-index: 1001;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
width: 240px; width: 240px;
box-sizing: border-box; box-sizing: border-box;
contain: strict; contain: strict;

View file

@ -220,8 +220,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
$ui-font-size: 1em; // TODO: $ui-font-size: 1em; // TODO:
$widgets-hide-threshold: 1090px; $widgets-hide-threshold: 1090px;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ min-height: 100dvh;
min-height: calc(var(--vh, 1vh) * 100);
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
@ -273,8 +272,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
top: 0; top: 0;
right: 0; right: 0;
z-index: 1001; z-index: 1001;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
padding: var(--margin); padding: var(--margin);
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;
@ -362,8 +360,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1001; z-index: 1001;
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ height: 100dvh;
height: calc(var(--vh, 1vh) * 100);
width: 240px; width: 240px;
box-sizing: border-box; box-sizing: border-box;
contain: strict; contain: strict;

View file

@ -28,8 +28,7 @@ document.documentElement.style.overflowY = 'scroll';
<style lang="scss" scoped> <style lang="scss" scoped>
.mk-app { .mk-app {
// 100vh ... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ min-height: 100dvh;
min-height: calc(var(--vh, 1vh) * 100);
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>