Skip to content

Commit

Permalink
feat: show controls on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 29, 2021
1 parent a676c90 commit a94bbc5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/client/internals/NavControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function downloadPDF() {
</script>

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

<button v-if="!isPresenter" class="icon-btn" @click="showEditor = !showEditor">
<button v-if="!isPresenter" class="icon-btn <md:hidden" @click="showEditor = !showEditor">
<carbon:edit />
</button>
</template>
Expand Down
14 changes: 11 additions & 3 deletions packages/client/internals/Play.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { SwipeDirection, useSwipe } from '@vueuse/core'
import { ref } from 'vue'
import { isPrintMode, showEditor, windowSize } from '../state'
import { isPrintMode, showEditor, windowSize, isScreenVertical } from '../state'
import { next, prev, currentRoute, tab, tabElements, prevSlide, nextSlide } from '../logic/nav'
import Controls from './Controls.vue'
import SlideContainer from './SlideContainer.vue'
Expand Down Expand Up @@ -51,8 +51,16 @@ const { direction, lengthX, lengthY } = useSwipe(root, {
@click="onClick"
>
<template #controls>
<div class="absolute bottom-0 left-0 p-2 transition duration-300 opacity-0 hover:opacity-100">
<NavControls class="rounded-md bg-main shadow dark:(border border-gray-400 border-opacity-10)" />
<div
class="absolute bottom-0 left-0 transition duration-300 opacity-0 hover:opacity-100"
:class="isScreenVertical ? 'opacity-100 right-0' : 'oapcity-0 p-2'"
>
<NavControls
class="m-auto"
:class="isScreenVertical
? 'text-white bg-transparent'
: 'rounded-md bg-main shadow dark:(border border-gray-400 border-opacity-10)'"
/>
</div>
</template>
</SlideContainer>
Expand Down
1 change: 1 addition & 0 deletions packages/client/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const query = useUrlSearchParams()
export const breakpoints = useBreakpoints(breakpointsTailwind)
export const windowSize = useWindowSize()
export const magicKeys = useMagicKeys()
export const isScreenVertical = computed(() => windowSize.width.value <= windowSize.height.value)

export const activeElement = useActiveElement()
export const isInputing = computed(() => ['INPUT', 'TEXTAREA'].includes(activeElement.value?.tagName || ''))
Expand Down
1 change: 1 addition & 0 deletions packages/slidev/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ cli.command(
.option('out', {
alias: 'o',
type: 'string',
default: 'dist',
describe: 'output dir',
})
.option('base', {
Expand Down

0 comments on commit a94bbc5

Please sign in to comment.