Skip to content

Commit

Permalink
Demo - Fix pauseOnTouch control rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Dec 9, 2023
1 parent 2de35e1 commit a76c77c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
16 changes: 7 additions & 9 deletions demo/components/nav/NavNotivueConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,24 @@ const isSwipeDisabled = computed(() => !config.pauseOnHover.value)

<template>
<div class="Controls">
<!-- Disabled must be toggled as a string (and not boolean), Nuxt bug? -->

<button
v-if="isDesktop"
v-if="isMobile()"
class="ButtonBase SwitchButton"
role="switch"
:aria-checked="config.pauseOnHover.value"
@click="togglePauseOnHover"
:aria-checked="config.pauseOnTouch.value"
@click="togglePauseOnTouch"
>
Pause on Hover
Pause on Touch
</button>

<button
v-else
class="ButtonBase SwitchButton"
role="switch"
:aria-checked="config.pauseOnTouch.value"
@click="togglePauseOnTouch"
:aria-checked="config.pauseOnHover.value"
@click="togglePauseOnHover"
>
Pause on Touch
Pause on Hover
</button>

<button
Expand Down
8 changes: 3 additions & 5 deletions demo/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export function getRandomInt(min: number, max: number) {

export const isSSR = typeof window === 'undefined'

export const isDesktop =
isSSR ||
/(Windows NT|Mac OS X|Linux|Ubuntu|Firefox|Chrome|Safari|Trident|MSIE)/i.test(
navigator.userAgent
)
export function isMobile() {
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent)
}

0 comments on commit a76c77c

Please sign in to comment.