Skip to content

Commit

Permalink
Replace VMenu with VBottomSheet for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Jun 5, 2024
1 parent 7b65c4b commit ac40a15
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
<template>
<VMenu>
<Component :is="menuComponent">
<template #activator="{ props }">
<VBtn v-bind="props"> Auto Mode: Off </VBtn>
</template>
<DialogOff></DialogOff>
</VMenu>
<div>
<Dialog class="dialog"></Dialog>
</div>
</Component>
</template>

<script setup lang="ts">
import DialogOff from "./Dialog.vue";
import { computed } from "vue";
import { useDisplay } from "vuetify";
import Dialog from "./Dialog.vue";
const { mobile } = useDisplay();
const menuComponent = computed(() => (mobile.value ? "VBottomSheet" : "VMenu"));
</script>

<style scoped>
.v-bottom-sheet .dialog {
border-radius: 0 !important;
padding: 4px 4px 24px 4px;
}
.v-menu .dialog {
width: 290px;
padding: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
<template>
<div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode is currently <span class="font-italic"> off </span>.
</p>
<p class="mt-3">
If on, it automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
<p class="mt-3">Turn on auto mode?</p>
</div>
</VCardText>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="turnOnFromScheduler">
turn on from scheduler
</VBtn>
</VCardActions>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="turnOnFromQueue"> turn on from queue </VBtn>
</VCardActions>
</VCard>
</div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode is currently <span class="font-italic"> off </span>.
</p>
<p class="mt-3">
If on, it automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
<p class="mt-3">Turn on auto mode?</p>
</div>
</VCardText>
<VCardActions>
<VBtn variant="outlined" @click="turnOnFromScheduler" class="flex-grow-1">
turn on from scheduler
</VBtn>
</VCardActions>
<VCardActions>
<VBtn variant="outlined" @click="turnOnFromQueue" class="flex-grow-1">
turn on from queue
</VBtn>
</VCardActions>
</VCard>
</template>

<script setup lang="ts">
Expand All @@ -45,10 +43,3 @@ async function turnOnFromQueue() {
await changeMode({ mode: "queue" });
}
</script>

<style scoped>
:deep(.v-card) {
width: 290px;
padding: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
<template>
<VMenu>
<Component :is="menuComponent">
<template #activator="{ props }">
<VBtn v-bind="props" variant="tonal" color="tertiary"> Auto Mode: Queue </VBtn>
</template>
<DialogOn></DialogOn>
</VMenu>
<div>
<Dialog class="dialog"></Dialog>
</div>
</Component>
</template>

<script setup lang="ts">
import DialogOn from "./Dialog.vue";
import { computed } from "vue";
import { useDisplay } from "vuetify";
import Dialog from "./Dialog.vue";
const { mobile } = useDisplay();
const menuComponent = computed(() => (mobile.value ? "VBottomSheet" : "VMenu"));
</script>

<style scoped>
.v-bottom-sheet .dialog {
border-radius: 0 !important;
padding: 4px 4px 24px 4px;
}
.v-menu .dialog {
width: 290px;
padding: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
<template>
<div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode currently is <span class="font-italic"> on </span> and loads
scripts from the <span class="font-italic"> queue </span>.
</p>
<p class="mt-3">
The auto mode automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
</div>
</VCardText>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="switchToLoadFromScheduler">
switch to load from scheduler
</VBtn>
</VCardActions>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="turnOff"> turn off auto mode </VBtn>
</VCardActions>
</VCard>
</div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode currently is <span class="font-italic"> on </span> and loads
scripts from the <span class="font-italic"> queue </span>.
</p>
<p class="mt-3">
The auto mode automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
</div>
</VCardText>
<VCardActions>
<VBtn variant="outlined" @click="switchToLoadFromScheduler" class="flex-grow-1">
switch to load from scheduler
</VBtn>
</VCardActions>
<VCardActions>
<VBtn variant="outlined" @click="turnOff" class="flex-grow-1">
turn off auto mode
</VBtn>
</VCardActions>
</VCard>
</template>

<script setup lang="ts">
Expand All @@ -44,10 +42,3 @@ async function turnOff() {
await changeMode({ mode: "off" });
}
</script>

<style scoped>
:deep(.v-card) {
width: 290px;
padding: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
<template>
<VMenu>
<Component :is="menuComponent">
<template #activator="{ props }">
<VBtn v-bind="props" variant="tonal" color="tertiary">
Auto Mode: Scheduler
</VBtn>
</template>
<DialogOn></DialogOn>
</VMenu>
<div>
<Dialog class="dialog"></Dialog>
</div>
</Component>
</template>

<script setup lang="ts">
import DialogOn from "./Dialog.vue";
import { computed } from "vue";
import { useDisplay } from "vuetify";
import Dialog from "./Dialog.vue";
const { mobile } = useDisplay();
const menuComponent = computed(() => (mobile.value ? "VBottomSheet" : "VMenu"));
</script>

<style scoped>
.v-bottom-sheet .dialog {
border-radius: 0 !important;
padding: 4px 4px 24px 4px;
}
.v-menu .dialog {
width: 290px;
padding: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
<template>
<div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode currently is <span class="font-italic"> on </span> and loads
scripts from the <span class="font-italic"> scheduler </span>.
</p>
<p class="mt-3">
The auto mode automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
</div>
</VCardText>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="switchToLoadFromQueue">
switch to load from queue
</VBtn>
</VCardActions>
<VCardActions>
<VSpacer></VSpacer>
<VBtn variant="outlined" @click="turnOff"> turn off auto mode </VBtn>
</VCardActions>
</VCard>
</div>
<VCard>
<VCardText>
<div class="mb-1">
<p class="font-weight-medium">
The auto mode currently is <span class="font-italic"> on </span> and loads
scripts from the <span class="font-italic"> scheduler </span>.
</p>
<p class="mt-3">
The auto mode automatically loads and runs the next script after each run
successfully ends.
</p>
<p class="mt-3">
The auto mode can load scripts from either the
<span class="font-italic"> scheduler </span> or the
<span class="font-italic"> queue </span>.
</p>
</div>
</VCardText>
<VCardActions>
<VBtn variant="outlined" @click="switchToLoadFromQueue" class="flex-grow-1">
switch to load from queue
</VBtn>
</VCardActions>
<VCardActions>
<VBtn variant="outlined" @click="turnOff" class="flex-grow-1">
turn off auto mode
</VBtn>
</VCardActions>
</VCard>
</template>

<script setup lang="ts">
Expand All @@ -44,10 +42,3 @@ async function turnOff() {
await changeMode({ mode: "off" });
}
</script>

<style scoped>
:deep(.v-card) {
width: 290px;
padding: 4px;
}
</style>

0 comments on commit ac40a15

Please sign in to comment.