forked from platypush/platypush
[media
UI] Extracted PlayPauseButton
into its own component.
This commit is contained in:
parent
7889846cd6
commit
a939cb648c
3 changed files with 38 additions and 12 deletions
|
@ -38,11 +38,7 @@
|
||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="playback-controls until tablet col-2">
|
<div class="playback-controls until tablet col-2">
|
||||||
<button @click="$emit(status.state === 'play' ? 'pause' : 'play')"
|
<PlayPauseButton :status="status" @play="$emit('play')" @pause="$emit('pause')" />
|
||||||
:title="status.state === 'play' ? 'Pause' : 'Play'">
|
|
||||||
<i class="icon play-pause fa fa-pause" v-if="status.state === 'play'"></i>
|
|
||||||
<i class="icon play-pause fa fa-play" v-else></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="track-container col-s-9 col-m-9 col-l-3">
|
<div class="track-container col-s-9 col-m-9 col-l-3">
|
||||||
|
@ -64,11 +60,7 @@
|
||||||
<button @click="$emit('previous')" title="Play previous track" v-if="buttons_.previous">
|
<button @click="$emit('previous')" title="Play previous track" v-if="buttons_.previous">
|
||||||
<i class="icon fa fa-step-backward"></i>
|
<i class="icon fa fa-step-backward"></i>
|
||||||
</button>
|
</button>
|
||||||
<button @click="$emit(status.state === 'play' ? 'pause' : 'play')"
|
<PlayPauseButton :status="status" @play="$emit('play')" @pause="$emit('pause')" />
|
||||||
:title="status.state === 'play' ? 'Pause' : 'Play'">
|
|
||||||
<i class="icon play-pause fa fa-pause" v-if="status.state === 'play'"></i>
|
|
||||||
<i class="icon play-pause fa fa-play" v-else></i>
|
|
||||||
</button>
|
|
||||||
<button @click="$emit('stop')" v-if="buttons_.stop && status.state !== 'stop'" title="Stop playback">
|
<button @click="$emit('stop')" v-if="buttons_.stop && status.state !== 'stop'" title="Stop playback">
|
||||||
<i class="icon fa fa-stop"></i>
|
<i class="icon fa fa-stop"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@ -105,11 +97,12 @@
|
||||||
import Utils from "@/Utils"
|
import Utils from "@/Utils"
|
||||||
import MediaUtils from "@/components/Media/Utils";
|
import MediaUtils from "@/components/Media/Utils";
|
||||||
import ExtraControls from "./ExtraControls";
|
import ExtraControls from "./ExtraControls";
|
||||||
|
import PlayPauseButton from "./PlayPauseButton";
|
||||||
import ProgressBar from "./ProgressBar";
|
import ProgressBar from "./ProgressBar";
|
||||||
import VolumeSlider from "./VolumeSlider";
|
import VolumeSlider from "./VolumeSlider";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {ExtraControls, ProgressBar, VolumeSlider},
|
components: {ExtraControls, PlayPauseButton, ProgressBar, VolumeSlider},
|
||||||
mixins: [Utils, MediaUtils],
|
mixins: [Utils, MediaUtils],
|
||||||
emits: [
|
emits: [
|
||||||
'consume',
|
'consume',
|
||||||
|
@ -316,7 +309,6 @@ button {
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
height: 50%;
|
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<template>
|
||||||
|
<button @click="$emit(status.state === 'play' ? 'pause' : 'play')"
|
||||||
|
:title="status.state === 'play' ? 'Pause' : 'Play'">
|
||||||
|
<i class="icon play-pause fa fa-pause" v-if="status.state === 'play'"></i>
|
||||||
|
<i class="icon play-pause fa fa-play" v-else></i>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
emits: ['play', 'pause'],
|
||||||
|
props: {
|
||||||
|
status: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
button {
|
||||||
|
font-size: 1.75em;
|
||||||
|
background: transparent;
|
||||||
|
color: $play-btn-fg;
|
||||||
|
padding: 0 !important;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $play-btn-hover-fg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -152,6 +152,7 @@ $input-icon-hover-border: 1px solid rgba(159, 180, 152, 0.83);
|
||||||
|
|
||||||
//// Media elements
|
//// Media elements
|
||||||
$play-btn-fg: #27ee5e !default;
|
$play-btn-fg: #27ee5e !default;
|
||||||
|
$play-btn-hover-fg: #5cfd88 !default;
|
||||||
|
|
||||||
//// Dropdown element
|
//// Dropdown element
|
||||||
$dropdown-bg: rgb(241, 243, 242) !default;
|
$dropdown-bg: rgb(241, 243, 242) !default;
|
||||||
|
|
Loading…
Reference in a new issue