Skip to content

Commit 568a37d

Browse files
committed
feat: click to next
1 parent cca69b8 commit 568a37d

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

src/App.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
<script setup lang="ts">
22
import { useHead } from '@vueuse/head'
33
import { computed } from 'vue'
4+
import { useNavigateControls } from './logic'
45
import { scale, targetHeight, targetWidth } from './logic/scale'
56
67
useHead({
78
title: 'Vite Slides',
89
meta: [],
910
})
1011
12+
const controls = useNavigateControls()
1113
const style = computed(() => ({
1214
height: `${targetHeight}px`,
1315
width: `${targetWidth}px`,
1416
transform: `translate(-50%, -50%) scale(${scale.value})`,
1517
}))
18+
19+
function onClick(e: MouseEvent) {
20+
const classList = (e.target as HTMLElement)?.classList
21+
if (classList?.contains('page-root'))
22+
controls.next()
23+
}
1624
</script>
1725

1826
<template>
19-
<div class="page">
27+
<div class="page-root" @click="onClick">
2028
<div class="slide-container" :style="style">
2129
<RouterView />
2230
</div>
2331
</div>
2432
<SlideControls />
2533
</template>
2634

27-
<style>
28-
.page {
29-
@apply w-screen h-screen relative overflow-hidden bg-black;
35+
<style lang="postcss">
36+
.page-root {
37+
@apply w-screen h-screen relative overflow-hidden bg-black select-none;
3038
}
3139
3240
.slide-container {

src/layouts/default.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
.master {
99
@apply px-14 py-10 text-[1.1rem];
1010
11+
h1, h2, h3, h4, p, div {
12+
@apply select-none;
13+
}
14+
15+
pre, code {
16+
@apply select-text;
17+
}
18+
1119
h1 {
1220
@apply text-4xl mb-4 -ml-[0.05em];
1321
}

src/layouts/end.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
</main>
55
</template>
66

7-
<style>
7+
<style lang="postcss">
88
.master.end {
9-
@apply text-white text-opacity-85 text-xl tracking-widest bg-black h-full text-center grid place-content-center;
9+
@apply text-white text-opacity-85 text-xl tracking-widest bg-black h-full text-center grid place-content-center select-none;
1010
}
1111
</style>

0 commit comments

Comments
 (0)