Skip to content

Commit a94bbc5

Browse files
committed
feat: show controls on mobile
1 parent a676c90 commit a94bbc5

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

packages/client/internals/NavControls.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function downloadPDF() {
3131
</script>
3232

3333
<template>
34-
<nav class="flex text-xl p-2 text-gray-600 dark:text-gray-300 gap-1">
34+
<nav class="flex flex-wrap-reverse text-xl p-2 gap-1">
3535
<button class="icon-btn" @click="toggleFullscreen">
3636
<carbon:minimize v-if="isFullscreen" />
3737
<carbon:maximize v-else />
@@ -69,7 +69,7 @@ async function downloadPDF() {
6969
<carbon:user-speaker />
7070
</a>
7171

72-
<button v-if="!isPresenter" class="icon-btn" @click="showEditor = !showEditor">
72+
<button v-if="!isPresenter" class="icon-btn <md:hidden" @click="showEditor = !showEditor">
7373
<carbon:edit />
7474
</button>
7575
</template>

packages/client/internals/Play.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { SwipeDirection, useSwipe } from '@vueuse/core'
33
import { ref } from 'vue'
4-
import { isPrintMode, showEditor, windowSize } from '../state'
4+
import { isPrintMode, showEditor, windowSize, isScreenVertical } from '../state'
55
import { next, prev, currentRoute, tab, tabElements, prevSlide, nextSlide } from '../logic/nav'
66
import Controls from './Controls.vue'
77
import SlideContainer from './SlideContainer.vue'
@@ -51,8 +51,16 @@ const { direction, lengthX, lengthY } = useSwipe(root, {
5151
@click="onClick"
5252
>
5353
<template #controls>
54-
<div class="absolute bottom-0 left-0 p-2 transition duration-300 opacity-0 hover:opacity-100">
55-
<NavControls class="rounded-md bg-main shadow dark:(border border-gray-400 border-opacity-10)" />
54+
<div
55+
class="absolute bottom-0 left-0 transition duration-300 opacity-0 hover:opacity-100"
56+
:class="isScreenVertical ? 'opacity-100 right-0' : 'oapcity-0 p-2'"
57+
>
58+
<NavControls
59+
class="m-auto"
60+
:class="isScreenVertical
61+
? 'text-white bg-transparent'
62+
: 'rounded-md bg-main shadow dark:(border border-gray-400 border-opacity-10)'"
63+
/>
5664
</div>
5765
</template>
5866
</SlideContainer>

packages/client/state/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const query = useUrlSearchParams()
1010
export const breakpoints = useBreakpoints(breakpointsTailwind)
1111
export const windowSize = useWindowSize()
1212
export const magicKeys = useMagicKeys()
13+
export const isScreenVertical = computed(() => windowSize.width.value <= windowSize.height.value)
1314

1415
export const activeElement = useActiveElement()
1516
export const isInputing = computed(() => ['INPUT', 'TEXTAREA'].includes(activeElement.value?.tagName || ''))

packages/slidev/node/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ cli.command(
106106
.option('out', {
107107
alias: 'o',
108108
type: 'string',
109+
default: 'dist',
109110
describe: 'output dir',
110111
})
111112
.option('base', {

0 commit comments

Comments
 (0)