Skip to content

Commit

Permalink
refactor(client): use dvh
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Nov 13, 2022
1 parent 1751bfe commit 831be69
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 28 deletions.
10 changes: 0 additions & 10 deletions packages/client/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ import { getAccountFromId } from '@/scripts/get-account-from-id';
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 (['smartphone', 'tablet'].includes(deviceKind)) {
const viewport = document.getElementsByName('viewport').item(0);
Expand Down
3 changes: 1 addition & 2 deletions packages/client/src/ui/_common_/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ function more(ev: MouseEvent) {
left: 0;
z-index: 1001;
width: $nav-icon-only-width;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
box-sizing: border-box;
overflow: auto;
overflow-x: clip;
Expand Down
6 changes: 2 additions & 4 deletions packages/client/src/ui/classic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ onMounted(() => {
$ui-font-size: 1em;
$widgets-hide-threshold: 1200px;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
min-height: calc(var(--vh, 1vh) * 100);
min-height: 100dvh;
box-sizing: border-box;
&.wallpaper {
Expand Down Expand Up @@ -301,8 +300,7 @@ onMounted(() => {
top: 0;
right: 0;
z-index: 1001;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
padding: var(--margin);
box-sizing: border-box;
overflow: auto;
Expand Down
6 changes: 2 additions & 4 deletions packages/client/src/ui/deck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ async function deleteProfile() {
--deckDividerThickness: 5px;
display: flex;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
box-sizing: border-box;
flex: 1;
Expand Down Expand Up @@ -424,8 +423,7 @@ async function deleteProfile() {
top: 0;
left: 0;
z-index: 1001;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
width: 240px;
box-sizing: border-box;
contain: strict;
Expand Down
9 changes: 3 additions & 6 deletions packages/client/src/ui/universal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
$ui-font-size: 1em; // TODO: どこかに集約したい
$widgets-hide-threshold: 1090px;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
min-height: calc(var(--vh, 1vh) * 100);
min-height: 100dvh;
box-sizing: border-box;
display: flex;
Expand Down Expand Up @@ -273,8 +272,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
top: 0;
right: 0;
z-index: 1001;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
padding: var(--margin);
box-sizing: border-box;
overflow: auto;
Expand Down Expand Up @@ -362,8 +360,7 @@ const wallpaper = localStorage.getItem('wallpaper') != null;
top: 0;
left: 0;
z-index: 1001;
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
height: calc(var(--vh, 1vh) * 100);
height: 100dvh;
width: 240px;
box-sizing: border-box;
contain: strict;
Expand Down
3 changes: 1 addition & 2 deletions packages/client/src/ui/zen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ document.documentElement.style.overflowY = 'scroll';

<style lang="scss" scoped>
.mk-app {
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
min-height: calc(var(--vh, 1vh) * 100);
min-height: 100dvh;
box-sizing: border-box;
}
</style>

0 comments on commit 831be69

Please sign in to comment.