Skip to content

Commit

Permalink
refactor: adding the audio component for show audio in post
Browse files Browse the repository at this point in the history
  • Loading branch information
rzashakeri committed Jul 2, 2022
1 parent 5f2f469 commit 7d6283d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
43 changes: 43 additions & 0 deletions post/templates/post/components/audio_component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<div class="music-player flex flex-col gap-4 w-full">
<p class="player-title text-xl font-bold ml-3">{{ post.audio.name }}
- {{ post.audio.artist }}</p>
<div class="player-body flex justify-between w-full">
<div id="waveform" class="audio-player flex gap-3 w-full "
src="http://127.0.0.1:8000/media/{{ post.audio.file }}">
<button id="playButton" class="playbackBtn self-center w-12 h-12">
<img
id="playButtonIcon"
class="play-button-icon"
src="/static/images/player/play.svg"
alt="Play Button"
/>
</button>
</div>
</div>
<div class="controls flex justify-between">
<div class="volume flex gap-3 items-center ml-3">
<img
id="volumeIcon"
class=" tooltip tooltip-bottom volume-icon h-6 w-6 cursor-pointer "
src="/static/images/player/volume.svg"
alt="Volume"
data-tip="mute/unmute"
/>

<input
id="volumeSlider"
class="volume-slider flex items-center"
type="range"
name="volume-slider"
min="0"
max="100"
value="50"
/>
</div>
<div class="timecode">
<span class="currentTime" id="currentTime">00:00:00</span>
<span>/</span>
<span class="totalDuration" id="totalDuration">00:00:00</span>
</div>
</div>
</div>
44 changes: 1 addition & 43 deletions post/templates/post/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,49 +30,7 @@
{% endthumbnail %}
{% endif %}
{% elif post.audio %}
<div class="music-player flex flex-col gap-4 w-full">
<p class="player-title text-xl font-bold ml-3">{{ post.audio.name }}
- {{ post.audio.artist }}</p>
<div class="player-body flex justify-between w-full">
<div id="waveform" class="audio-player flex gap-3 w-full "
src="http://127.0.0.1:8000/media/{{ post.audio.file }}">
<button id="playButton" class="playbackBtn self-center w-12 h-12">
<img
id="playButtonIcon"
class="play-button-icon"
src="/static/images/player/play.svg"
alt="Play Button"
/>
</button>
</div>
</div>
<div class="controls flex justify-between">
<div class="volume flex gap-3 items-center ml-3">
<img
id="volumeIcon"
class=" tooltip tooltip-bottom volume-icon h-6 w-6 cursor-pointer "
src="/static/images/player/volume.svg"
alt="Volume"
data-tip="mute/unmute"
/>

<input
id="volumeSlider"
class="volume-slider flex items-center"
type="range"
name="volume-slider"
min="0"
max="100"
value="50"
/>
</div>
<div class="timecode">
<span class="currentTime" id="currentTime">00:00:00</span>
<span>/</span>
<span class="totalDuration" id="totalDuration">00:00:00</span>
</div>
</div>
</div>
{% include "post/components/audio_component.html" %}
{% elif post.video %}
{% include "post/components/video_component.html" %}
{% endif %}
Expand Down

0 comments on commit 7d6283d

Please sign in to comment.