mirror of
https://github.com/Floriansylvain/musee-illusion-mobile.git
synced 2026-08-19 11:43:17 +02:00
feat: audio guide style
This commit is contained in:
@@ -0,0 +1,77 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { IonIcon } from "@ionic/vue";
|
||||||
|
import {
|
||||||
|
playCircle as playIcon,
|
||||||
|
pauseCircle as pauseIcon,
|
||||||
|
} from "ionicons/icons";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
src: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const audioRef = ref<HTMLAudioElement | null>(null);
|
||||||
|
const isPlaying = ref(false);
|
||||||
|
|
||||||
|
const toggleAudio = () => {
|
||||||
|
if (audioRef.value?.paused) {
|
||||||
|
audioRef.value?.play();
|
||||||
|
} else {
|
||||||
|
audioRef.value?.pause();
|
||||||
|
}
|
||||||
|
isPlaying.value = !audioRef.value?.paused;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<audio preload="auto" ref="audioRef" :src="props.src"></audio>
|
||||||
|
<article class="audio-guide">
|
||||||
|
<button type="button" @click="toggleAudio">
|
||||||
|
<ion-icon :icon="isPlaying ? pauseIcon : playIcon"></ion-icon>
|
||||||
|
</button>
|
||||||
|
<aside>
|
||||||
|
<h5>AUDIO GUIDE</h5>
|
||||||
|
<p>uwu uwu uwu uwu uwu uwu uwu uwu uwu</p>
|
||||||
|
</aside>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.audio-guide {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
padding: 8px;
|
||||||
|
|
||||||
|
color: var(--ion-color-light-tint);
|
||||||
|
background-color: var(--ion-color-dark);
|
||||||
|
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.audio-guide button {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.audio-guide ion-icon {
|
||||||
|
width: 43px;
|
||||||
|
height: 43px;
|
||||||
|
fill: var(--ion-color-light-tint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.audio-guide p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { IonPage } from "@ionic/vue";
|
import { IonPage } from "@ionic/vue";
|
||||||
import PagesHeader from "@/components/PagesHeader.vue";
|
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { Swiper, SwiperSlide } from "swiper/vue";
|
import { Swiper, SwiperSlide } from "swiper/vue";
|
||||||
import { Pagination } from "swiper/modules";
|
import { Pagination } from "swiper/modules";
|
||||||
import { CapacitorHttp } from "@capacitor/core";
|
import { CapacitorHttp } from "@capacitor/core";
|
||||||
|
|
||||||
|
import PagesHeader from "@/components/PagesHeader.vue";
|
||||||
|
import AudioGuide from "@/components/AudioGuide.vue";
|
||||||
|
|
||||||
import "swiper/css";
|
import "swiper/css";
|
||||||
import "swiper/css/pagination";
|
import "swiper/css/pagination";
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ onMounted(async () => {
|
|||||||
<section>
|
<section>
|
||||||
<h4>{{ element.fields.titre }}</h4>
|
<h4>{{ element.fields.titre }}</h4>
|
||||||
<img :src="element.fields.image[0].url" alt="hallan" />
|
<img :src="element.fields.image[0].url" alt="hallan" />
|
||||||
<audio controls :src="element.fields.audio[0].url"></audio>
|
<AudioGuide :src="element.fields.audio[0].url" />
|
||||||
</section>
|
</section>
|
||||||
</swiper-slide>
|
</swiper-slide>
|
||||||
</swiper>
|
</swiper>
|
||||||
@@ -71,7 +73,7 @@ onMounted(async () => {
|
|||||||
section {
|
section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 16px;
|
||||||
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -124,7 +126,7 @@ audio {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-top: 16px;
|
margin-top: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mySwiper {
|
.mySwiper {
|
||||||
|
|||||||
Reference in New Issue
Block a user