-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b5a829
commit 298f8b3
Showing
3 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<script setup lang="ts"> | ||
import { ref, onMounted } from 'vue' | ||
import Bubble from './Bubble.vue' | ||
const title = ref() | ||
const id = ref('') | ||
const scrollWindow = ref<HTMLElement>() | ||
const scrollPos = ref(0) | ||
let maxWidth = 0 | ||
onMounted(() => { | ||
if (title.value) { | ||
id.value = title.value.textContent.trim() | ||
} | ||
maxWidth = scrollWindow.value ? (scrollWindow.value?.scrollWidth - scrollWindow.value?.clientWidth) : 0 | ||
}) | ||
const onScroll = () => { | ||
if (scrollWindow.value?.scrollLeft == 0) scrollPos.value = 0 | ||
if (scrollWindow.value?.scrollLeft == maxWidth/2) scrollPos.value = maxWidth/2 | ||
if (scrollWindow.value?.scrollLeft == maxWidth) scrollPos.value = maxWidth | ||
} | ||
</script> | ||
|
||
<template> | ||
<Bubble :always-dropdown="false"> | ||
<template #title> | ||
<slot name="title"></slot> | ||
</template> | ||
<template #body> | ||
<div class="flex flex-col items-center gap-4"> | ||
<div | ||
ref="scrollWindow" | ||
@scroll="onScroll" | ||
class="flex gap-8 w-full overflow-x-scroll snap-x snap-mandatory lg:overflow-x-auto" | ||
> | ||
<div | ||
class="min-w-full lg:min-w-0 lg:w-1/3 text-notebookText bg-slate p-6 rounded-[3.2em] snap-center" | ||
> | ||
<h3 class="text-subtitle-sm lg:text-subtitle text-white mb-4"> | ||
<slot name="left-title"></slot> | ||
</h3> | ||
<slot name="left-body"></slot> | ||
</div> | ||
<div | ||
class="min-w-full lg:min-w-0 lg:w-1/3 text-notebookText bg-slate p-6 rounded-[3.2em] snap-center" | ||
> | ||
<h3 class="text-subtitle-sm lg:text-subtitle text-white mb-4"> | ||
<slot name="mid-title"></slot> | ||
</h3> | ||
<slot name="mid-body"></slot> | ||
</div> | ||
<div | ||
class="min-w-full lg:min-w-0 lg:w-1/3 text-notebookText bg-slate p-6 rounded-[3.2em] snap-center" | ||
> | ||
<h3 class="text-subtitle-sm lg:text-subtitle text-white mb-4"> | ||
<slot name="right-title"></slot> | ||
</h3> | ||
<slot name="right-body"></slot> | ||
</div> | ||
</div> | ||
<div v-if="$windowWidth < 1024" class="flex justify-center gap-4"> | ||
<span | ||
:class="{ | ||
'bg-notebookText': scrollPos == 0, | ||
'border border-notebookText': scrollPos != 0 | ||
}" | ||
class="w-2 h-2 rounded-full transition duration-500" | ||
></span> | ||
<span | ||
:class="{ | ||
'bg-notebookText': scrollPos == maxWidth/2, | ||
'border border-notebookText': scrollPos != maxWidth/2 | ||
}" | ||
class="w-2 h-2 rounded-full transition duration-500" | ||
></span> | ||
<span | ||
:class="{ | ||
'bg-notebookText': scrollPos == maxWidth, | ||
'border border-notebookText': scrollPos != maxWidth | ||
}" | ||
class="w-2 h-2 rounded-full transition duration-500" | ||
></span> | ||
</div> | ||
</div> | ||
</template> | ||
</Bubble> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters