Skip to content

Commit

Permalink
Merge pull request #4 from dropways/development
Browse files Browse the repository at this point in the history
Card 02 html
  • Loading branch information
dropways committed Jun 25, 2023
2 parents 85fd566 + ba66ae1 commit 59ea835
Show file tree
Hide file tree
Showing 8 changed files with 534 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ We value your feedback and suggestions, as they help us improve our offerings an

## Demo

| Card - 01 |
| --- |
| [![Card - 01](https://github-production-user-asset-6210df.s3.amazonaws.com/38377336/248484878-f72db189-3e98-454d-81bd-20ab3323a2e4.jpg)](https://dropways.github.io/card-ui/cards/card-01/)
| Card - 01 | Card - 02 |
| --- | --- |
| [![Card - 01](https://github-production-user-asset-6210df.s3.amazonaws.com/38377336/248484878-f72db189-3e98-454d-81bd-20ab3323a2e4.jpg)](https://dropways.github.io/card-ui/cards/card-01/) | [![Card - 02](https://github-production-user-asset-6210df.s3.amazonaws.com/38377336/248573168-d5c5fecd-3423-4b93-8e95-04b5cd517192.jpg)](https://dropways.github.io/card-ui/cards/card-02/)

## Browser Support

Expand Down
4 changes: 1 addition & 3 deletions assets/css/prism.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ pre[class*="language-"] {
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
/* This background color was intended by the author of this theme. */
background: hsla(0, 0%, 100%, .5);
color: #ff8a00;
}

.token.atrule,
Expand Down
9 changes: 7 additions & 2 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ a:focus {
text-decoration: none;
color: #000;
}

*:focus-visible {
outline: 0;
}
.btn:focus {
box-shadow: none;
}
Expand Down Expand Up @@ -501,6 +503,9 @@ input:-ms-input-placeholder {
padding: 48px 16px;
font-family: 'Inter', sans-serif;
}
.layout-card-wrap{
width: 100%;
}

@media (max-width: 767px){
.logo a span{display: none;}
Expand Down Expand Up @@ -614,7 +619,7 @@ input:-ms-input-placeholder {

@media (min-width: 576px) {
.modal-dialog {
max-width: 720px;
max-width: 820px;
margin-right: auto;
margin-left: auto;
}
Expand Down
1 change: 1 addition & 0 deletions cards/card-01/card-1.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
background: #ffffff;
border-radius: 20px;
max-width: 360px;
width: 100%;
margin: 0 auto;
}
.card__header{
Expand Down
187 changes: 187 additions & 0 deletions cards/card-02/card-2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
.card {
background: #ffffff;
border-radius: 20px;
max-width: 360px;
width: 100%;
margin: 0 auto;
}

.card__header {
padding: 24px;
display: flex;
align-items: center;
}

.card__header .icon {
font-size: 24px;
line-height: 1;
color: #000000;
flex-shrink: 0;
margin-left: auto;
}

.card__body {
padding: 0px 24px 24px;
}

.card__footer {
padding: 24px;
font-size: 18px;
color: #78858F;
}

.track-art {
padding-bottom: 16px;
}

.track-art img {
width: 172px;
height: 172px;
object-fit: cover;
border-radius: 100%;
display: block;
margin: 0 auto;
}

.track-name {
font-size: 24px;
font-weight: 600;
color: #000000;
text-align: center;
padding-bottom: 8px;
}

.track-artist {
font-size: 16px;
color: #737373;
text-align: center;
padding-bottom: 24px;
}

.buttons {
display: flex;
align-items: center;
justify-content: center;
padding-top: 24px;
}

.player-btn {
margin: 0 6px;
width: 40px;
height: 40px;
color: #000000;
font-size: 24px;
border-radius: 100%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: transparent;
}

.player-btn.player-btn-play {
width: 52px;
height: 52px;
background: #FF3C78;
color: #ffffff;
}

.slider_container {
display: flex;
align-items: center;
width: 100%;
font-size: 14px;
font-weight: 500;
}

.slider_container .ti {
font-size: 24px;
}

.cr-slider {
-webkit-appearance: none;
background-color: transparent;
cursor: pointer;
width: 100%;
margin: 0 16px;
}

.cr-slider::-webkit-slider-runnable-track {
width: 100%;
height: 6px;
background: #EBEBEB;
border: 0;
border-radius: 6px;
}

.cr-slider::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #FF3C78;
margin-top: -6px;
}

.cr-slider:focus {
outline: none;
}

.cr-slider::-moz-range-track {
width: 100%;
height: 6px;
background: #EBEBEB;
border: 0;
border-radius: 3px;
}

.cr-slider::-moz-range-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #FF3C78;
margin-top: -6px;
}

.cr-slider:-moz-focusring {
outline: 1px solid white;
outline-offset: -1px;
}

.cr-slider::-ms-track {
width: 100%;
height: 6px;
background: transparent;
border-color: transparent;
border-width: 6px 0;
color: transparent;
}

.cr-slider::-ms-fill-lower {
background: #EBEBEB;
border-radius: 10px;
}

.cr-slider::-ms-fill-upper {
background: #EBEBEB;
border-radius: 10px;
}

.cr-slider::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #2A2662;
margin-top: 1px;
}

.cr-slider:focus::-ms-fill-lower {
background: #EBEBEB;
}

.cr-slider:focus::-ms-fill-upper {
background: #EBEBEB;
}
141 changes: 141 additions & 0 deletions cards/card-02/card-2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// Audio Player Js
let track_art = document.querySelector(".track-art");
let track_art_img = document.querySelector(".track-art-img");
let track_name = document.querySelector(".track-name");
let track_artist = document.querySelector(".track-artist");

let playpause_btn = document.querySelector(".playpause-track");
let next_btn = document.querySelector(".next-track");
let prev_btn = document.querySelector(".prev-track");

let seek_slider = document.querySelector(".seek_slider");
let volume_slider = document.querySelector(".volume_slider");
let curr_time = document.querySelector(".current-time");
let total_duration = document.querySelector(".total-duration");

let track_index = 0;
let isPlaying = false;
let updateTimer;

// Create new audio element
let curr_track = document.createElement("audio");

// Define the tracks that have to be played
let track_list = [
{
name: "Shipping Lanes",
artist: "Chad Crouch",
image: "https://images.pexels.com/photos/1717969/pexels-photo-1717969.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250",
path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/Chad_Crouch/Arps/Chad_Crouch_-_Shipping_Lanes.mp3",
},
{
name: "Night Owl",
artist: "Broke For Free",
image: "https://images.pexels.com/photos/2264753/pexels-photo-2264753.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250",
path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Broke_For_Free/Directionless_EP/Broke_For_Free_-_01_-_Night_Owl.mp3",
},
{
name: "Enthusiast",
artist: "Tours",
image: "https://images.pexels.com/photos/3100835/pexels-photo-3100835.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250",
path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Tours/Enthusiast/Tours_-_01_-_Enthusiast.mp3",
},
];

function loadTrack(track_index) {
clearInterval(updateTimer);
resetValues();
curr_track.src = track_list[track_index].path;
curr_track.load();

track_art_img.src = track_list[track_index].image;
track_name.textContent = track_list[track_index].name;
track_artist.textContent = track_list[track_index].artist;

updateTimer = setInterval(seekUpdate, 1000);
curr_track.addEventListener("ended", nextTrack);
}

function resetValues() {
curr_time.textContent = "00:00";
total_duration.textContent = "00:00";
seek_slider.value = 0;
}

// Load the first track in the tracklist
loadTrack(track_index);

function playpauseTrack() {
if (!isPlaying) playTrack();
else pauseTrack();
}

function playTrack() {
curr_track.play();
isPlaying = true;
playpause_btn.innerHTML = '<i class="ti ti-player-pause"></i>';
}

function pauseTrack() {
curr_track.pause();
isPlaying = false;
playpause_btn.innerHTML = '<i class="ti ti-player-play"></i>';
}

function nextTrack() {
if (track_index < track_list.length - 1) track_index += 1;
else track_index = 0;
loadTrack(track_index);
playTrack();
}

function prevTrack() {
if (track_index > 0) track_index -= 1;
else track_index = track_list.length;
loadTrack(track_index);
playTrack();
}

function seekTo() {
let seekto = curr_track.duration * (seek_slider.value / 100);
curr_track.currentTime = seekto;
}

function setVolume() {
curr_track.volume = volume_slider.value / 100;
}

function seekUpdate() {
let seekPosition = 0;

if (!isNaN(curr_track.duration)) {
seekPosition = curr_track.currentTime * (100 / curr_track.duration);

seek_slider.value = seekPosition;

let currentMinutes = Math.floor(curr_track.currentTime / 60);
let currentSeconds = Math.floor(
curr_track.currentTime - currentMinutes * 60
);
let durationMinutes = Math.floor(curr_track.duration / 60);
let durationSeconds = Math.floor(
curr_track.duration - durationMinutes * 60
);

if (currentSeconds < 10) {
currentSeconds = "0" + currentSeconds;
}
if (durationSeconds < 10) {
durationSeconds = "0" + durationSeconds;
}
if (currentMinutes < 10) {
currentMinutes = "0" + currentMinutes;
}
if (durationMinutes < 10) {
durationMinutes = "0" + durationMinutes;
}

curr_time.textContent = currentMinutes + ":" + currentSeconds;
total_duration.textContent = durationMinutes + ":" + durationSeconds;
}
}
Loading

0 comments on commit 59ea835

Please sign in to comment.