diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6837f24..b63150d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,12 +16,13 @@ [ ] - Not correct; marked as **not** done --> -- [ ] My code follows the coding standards of this project. -- [ ] This PR does not contain plagiarized content. -- [ ] The title of my pull request is a short description of the requested changes. +- [] My code follows the coding standards of this project. +- [] This PR does not contain plagiarized content. +- [] The title of my pull request is a short description of the requested changes. ## 📄 Note to reviewers ## 📷 Screenshots + diff --git a/assets/css/explore.css b/assets/css/explore.css index 0c9ce78..ed2e364 100644 --- a/assets/css/explore.css +++ b/assets/css/explore.css @@ -1,3 +1,464 @@ +:root { + + --page-background-color: #181818; + --text-color-titles: #fff; + --text-color-desc: #aaaaaa; + --type-card-background-color: #212121; + --type-card-background-hover-color: #3d3d3d; + } + +.bg { + -webkit-mask-image: linear-gradient(to top, transparent 2%, black 20%); +} + body { - font-family: 'Roboto', sans-serif; -} \ No newline at end of file + align-items: center; + background-color: var(--page-background-color); + display: flex; + flex-direction: column; + font-family: "Roboto", sans-serif; +} + +.container-card { + background-color: var(--page-background-color); + margin-top: 56px; + /* max-width: 1335px; */ + padding: 14px 14px 14px 14px; +} + +.container-card button:hover { + background-color: #000; + border-style: border solid 14px; + transition: 0s; +} + +.max-height { + max-height: 300px; +} + +.more-options svg { + color: var(--text-color-titles); + height: 10px; + transform: scale(1.5); + width: 10px; +} + +.owl-carousel .owl-nav button.owl-next { + background-color: var(--type-card-background-color); + border: none; + border-radius: 50px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.8); + color: inherit; + font: inherit; + font-size: 24px; + height: 40px; + padding: 0 !important; + position: absolute; + right: 0; + top: 18%; + transform: translate(20px, 0); + width: 40px; +} + +.owl-carousel .owl-nav button.owl-next:active { + background-color: var(--type-card-background-hover-color); +} + +.owl-carousel .owl-nav button.owl-next.disabled { + display: none; +} + +.owl-carousel .owl-nav button.owl-prev { + background-color: var(--type-card-background-color); + border: none; + border-radius: 50px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.8); + color: inherit; + font: inherit; + font-size: 24px; + height: 40px; + padding: 0 !important; + position: absolute; + top: 18%; + transform: translate(-20px, 0); + width: 40px; +} + +.owl-carousel .owl-nav button.owl-prev:active { + background-color: var(--type-card-background-hover-color); +} + +.owl-carousel .owl-nav button.owl-prev.disabled { + display: none; +} + +.separator { + background-color: var(--type-card-background-hover-color); + height: 1px; + margin-bottom: 30px; +} + +.shorts-card { + color: var(--text-color-titles); + margin: 0px 10px 0px 0px; + width: 210px; +} + +.shorts-card-container { + color: var(--text-color-titles); + display: flex; + flex-direction: row !important; + gap: 20px; +} + +.shorts-card:hover .video-hover svg { + cursor: pointer; + transition: 1 0.8s ease; + visibility: visible; +} + +.shorts-card:hover { + cursor: pointer; +} + +.shorts-more-options { + color: var(--text-color-titles); +} + +.shorts-statistic-info { + color: var(--text-color-desc); + display: flex; + flex-direction: row; + font-size: 12px; + font-weight: 400; +} + +.shorts-statistic-info i { + color: var(--text-color-desc); + display: flex; + flex-direction: row; + transform: scale(0.3); +} + +.shorts-video-container { + height: 118px; + width: 210px; +} + +.shorts-video-container img { + height: 118px; + object-fit: cover; + width: 210px; +} + +.shorts-video-container svg { + background-color: var(--page-background-color); + border-radius: 2px; + color: var(--text-color-titles); + height: 25px; + object-fit: cover; + opacity: 0.8; + padding: 3px; + transform: translate(180px, -115px); + visibility: hidden; + width: 25px; +} + +.shorts-video-channel { + color: var(--text-color-desc); + font-size: 12px; + font-weight: 400; +} + +.shorts-video-channel:hover { + color: var(--text-color-titles); +} + +.shorts-video-details { + align-items: flex-end; + display: flex; + flex-direction: column; +} + +.shorts-video-info a { + color: var(--text-color-desc); + text-decoration: none; +} + +.shorts-video-title-container { + display: flex; + margin-top: 10px; +} + +.shorts-video-title { + display: block; + overflow: hidden; + width: 210px; +} + +.shorts-video-title p { + color: var(--text-color-titles); + font-size: 14px; + margin-bottom: 0px; +} + +.line-clamp { + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + display: -webkit-box; +} + +.show-more { + background-color: transparent; + border: none; + color: var(--text-color-titles); + height: 70px; + transform: translate(0, -65px); + width: 100%; +} + +.show-more:hover { + background-color: #000; +} + +.statistic-info { + display: flex; + gap: 3px; +} + +.statistic-info i { + transform: scale(0.3); +} + +.trending-shorts-container { + width: 100%; +} + +.trending-videos { + color: var(--text-color-titles); + margin-bottom: 20px; +} + +.trending-videos-container { + color: var(--text-color-titles); + margin: 30px 0 0 0; + max-width: 860px; +} + +.type-card { + background-color: var(--type-card-background-color); + border-radius: 9px; + color: var(--text-color-titles); + display: flex; + flex-direction: column; + font-size: 16px; + gap: 20px; + height: 116px; + margin: 0; + margin-bottom: 3px; + margin-left: 3px; + padding: 20px; + width: 210px; +} + +.type-card:hover { + background-color: var(--type-card-background-hover-color); + cursor: pointer; +} + +.type-card-img { + width: 32px; +} + +.video-card { + background-color: var(--page-background-color); + display: flex; + flex-direction: row; + font-size: 12px; + gap: 15px; + margin-bottom: 10px; + max-width: 860px; +} + +.video-channel:hover { + color: var(--text-color-titles); +} + +.video-container a { + text-decoration: none; +} + +.video-container { + cursor: pointer; + height: auto; + width: 246px; +} + +.video-container img { + height: 137px; + object-fit: cover; + width: 246px; +} + +.video-container svg { + background-color: var(--page-background-color); + border-radius: 2px; + color: var(--text-color-titles); + height: 25px; + object-fit: cover; + opacity: 0.8; + padding: 3px; + transform: translate(218px, -132px); + visibility: hidden; + width: 25px; +} + +.video-container:hover svg { + cursor: pointer; + transition: 1 0.8s ease; + visibility: visible; +} + +.video-desc { + display: block; +} + +.video-desc p { + overflow: hidden; + text-overflow: ellipsis; +} + +.video-info { + color: var(--text-color-desc); + display: flex; + flex-direction: column; + gap: 2px; + overflow: hidden; + text-overflow: ellipsis; +} + +.video-info a { + color: var(--text-color-desc); + text-decoration: none; +} + +.video-title { + color: var(--text-color-titles); + font-size: 18px; + font-weight: 400; + margin: 0; + min-width: 100px; + overflow: hidden; + padding: 0; + text-overflow: ellipsis; +} + +.video-title p { + color: var(--text-color-titles); + font-size: 18px; + font-weight: 400; + margin: 0; + min-width: 100px; + overflow: hidden; + padding: 0; + text-overflow: ellipsis; +} + +.video-title-container { + display: flex; + flex-direction: row; + gap: 50px; + justify-content: space-between; +} + +@media (min-width: 1186px) { + .bg { + -webkit-mask-image: linear-gradient(to top, transparent 2%, black 0%); + } + + .container-card { + max-width: 1070px; + } + + .show-more { + display: none; + } + + .video-desc p { + max-width: 614px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + +} + +@media (max-width: 1186px) { + .container-card { + max-width: 860px; + } + + .video-desc p { + max-width: 614px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + +} + +@media (max-width: 974px) { + .container-card { + max-width: 650px; + } + + .video-desc p { + max-width: 361px; + overflow-y: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + +} + +@media (max-width: 686px) { + .container-card { + max-width: 435px; + } + + .video-card { + height: 137px; + overflow: hidden; + text-overflow: ellipsis; + } + + .video-desc { + display: block; + } + + .video-desc p { + max-width: 150px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .video-title-container { + display: flex; + flex-direction: row; + gap: 5px; + } + + .video-title { + display: block; + } + + .video-title p { + max-width: 130px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + +} + diff --git a/assets/images/logo.png b/assets/images/logos/logo.png similarity index 100% rename from assets/images/logo.png rename to assets/images/logos/logo.png diff --git a/assets/images/logos/youtube-shorts.png b/assets/images/logos/youtube-shorts.png new file mode 100644 index 0000000..756b3ab Binary files /dev/null and b/assets/images/logos/youtube-shorts.png differ diff --git a/assets/images/svg/youtube-shorts.svg b/assets/images/svg/youtube-shorts.svg new file mode 100644 index 0000000..a2416c2 --- /dev/null +++ b/assets/images/svg/youtube-shorts.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/assets/images/thumbnail/thumbnail.png b/assets/images/thumbnail/thumbnail.png new file mode 100644 index 0000000..f361d1b Binary files /dev/null and b/assets/images/thumbnail/thumbnail.png differ diff --git a/assets/images/type-icons/fashion_and_beauty_color_64.png b/assets/images/type-icons/fashion_and_beauty_color_64.png new file mode 100644 index 0000000..db1d88f Binary files /dev/null and b/assets/images/type-icons/fashion_and_beauty_color_64.png differ diff --git a/assets/images/type-icons/gaming_color_64.png b/assets/images/type-icons/gaming_color_64.png new file mode 100644 index 0000000..622fc2f Binary files /dev/null and b/assets/images/type-icons/gaming_color_64.png differ diff --git a/assets/images/type-icons/learning_color_64_v1.png b/assets/images/type-icons/learning_color_64_v1.png new file mode 100644 index 0000000..85059f5 Binary files /dev/null and b/assets/images/type-icons/learning_color_64_v1.png differ diff --git a/assets/images/type-icons/live_color_64.png b/assets/images/type-icons/live_color_64.png new file mode 100644 index 0000000..789d6c5 Binary files /dev/null and b/assets/images/type-icons/live_color_64.png differ diff --git a/assets/images/type-icons/movies_color_64.png b/assets/images/type-icons/movies_color_64.png new file mode 100644 index 0000000..948c004 Binary files /dev/null and b/assets/images/type-icons/movies_color_64.png differ diff --git a/assets/images/type-icons/music_color_64.png b/assets/images/type-icons/music_color_64.png new file mode 100644 index 0000000..672fa48 Binary files /dev/null and b/assets/images/type-icons/music_color_64.png differ diff --git a/assets/images/type-icons/news_color_64.png b/assets/images/type-icons/news_color_64.png new file mode 100644 index 0000000..7bdf9dc Binary files /dev/null and b/assets/images/type-icons/news_color_64.png differ diff --git a/assets/images/type-icons/sports_color_64.png b/assets/images/type-icons/sports_color_64.png new file mode 100644 index 0000000..c51955e Binary files /dev/null and b/assets/images/type-icons/sports_color_64.png differ diff --git a/assets/images/type-icons/trending_color_64.png b/assets/images/type-icons/trending_color_64.png new file mode 100644 index 0000000..b4e018e Binary files /dev/null and b/assets/images/type-icons/trending_color_64.png differ diff --git a/assets/scripts/explore.js b/assets/scripts/explore.js index e69de29..beee68c 100644 --- a/assets/scripts/explore.js +++ b/assets/scripts/explore.js @@ -0,0 +1,300 @@ +const showMore = document.querySelector(".show-more"); +const maxHeight = document.querySelector(".max-height"); +const content = document.querySelector("#container-content"); +const typeCard = document.querySelector(".type-grid"); +const videoCardContainer1 = document.querySelector(".video-card-container-1"); +const videoCardContainer2 = document.querySelector(".video-card-container-2"); +const shortsCardContainer = document.querySelector(".shorts-card-container"); + + +const gridCard = [ + {type:"Trending", icon:"assets/images/type-icons/trending_color_64.png"}, + {type:"Music", icon:"assets/images/type-icons/music_color_64.png"}, + {type:"Movies", icon:"assets/images/type-icons/movies_color_64.png"}, + {type:"Live", icon:"assets/images/type-icons/live_color_64.png"}, + {type:"Gaming", icon:"assets/images/type-icons/gaming_color_64.png"}, + {type:"News", icon:"assets/images/type-icons/news_color_64.png"}, + {type:"Sports", icon:"assets/images/type-icons/sports_color_64.png"}, + {type:"Learning", icon:"assets/images/type-icons/learning_color_64_v1.png"}, + {type:"Fashion & Beauty", icon:"assets/images/type-icons/fashion_and_beauty_color_64.png"} + +]; + +const createGridCard = function (arrayOfGridCard) { + + for(let i = 0; i < arrayOfGridCard.length; i++){ + + typeCard.innerHTML +=` + +
+ + +
+ ${arrayOfGridCard[i].type} +
+
+ + ` + + } + + +} + +createGridCard(gridCard); + +fetch("/assets/videos.json") + .then((response) => response.json()) + .then((data) => { + + + + const arrayOfVideos = [...data.items]; + + //before shorts + for (let i = 0; i < 2; i++) { + createVideoCard(arrayOfVideos[i],videoCardContainer1); + } + + createShortsCard(arrayOfVideos); + + //after shorts + for (let i = 2; i < arrayOfVideos.length - 1; i++) { + createVideoCard(arrayOfVideos[i],videoCardContainer2); + } + + + }); + +showMore.addEventListener("click", () => { + maxHeight.style.maxHeight = "max-content"; + showMore.style.display = "none"; + content.classList.remove("bg"); +}); + +const createVideoCard = (data,videoCardContainer) => { + videoCardContainer.innerHTML += ` +
+ +
+ + + + + +
+ + + + +
+ +
+ +
+ +
+ +
+ + + +
+ +
+

${data.snippet.title}

+
+ +
+ + + + + +
+ +
+ +
+ +
${data.snippet.channelTitle}
+ +
+ +
+ +
2.3K views
+ + +
${createDates(data.snippet.publishedAt)}
+ +
+ +
+ +

${data.snippet.description}

+ +
+ + + +
+ +
+ +
+`; +}; + + +const createShortsCard = (data) => { + for (let j = 0; j < data.length - 1; j++) { + shortsCardContainer.innerHTML += ` +
+ +
+ + + + + +
+ + + + + + +
+ +
+ +
+ +
+ +
+ + + +
+ +
+

${data[j].snippet.title}

+
+ +
+ + + +
+
+ +
+ +
${data[j].snippet.channelTitle}
+ +
+ +
+ +
2.3K views
+ + + +
${createDates(data[j].snippet.publishedAt)}
+ +
+ + + +
+ +
+ +
`; + } + +$(".owl-carousel").owlCarousel({ + margin: 25, + nav: true, + items: 5, + slideBy: 5, + smartSpeed: 50, + responsive: { + 0: { + items: 2, + }, + 650: { + items: 3, + }, + 856: { + items: 4, + }, + 1070: { + items: 5, + }, + }, + }); +}; + +const createDates = (data) => { + let publishDate = data; + + let [date, time] = publishDate.split("T"); + let [year, month, day] = date.split("-"); + let [hour, minute, second] = time.split(":"); + second = second.slice(0, -1); + + const today = new Date(); + const currYear = today.getFullYear(); + const currMonth = today.getMonth() + 1; + const currDay = today.getDate(); + const currHour = today.getHours(); + const currMinute = today.getMinutes(); + const currSeconds = today.getSeconds(); + + let numOfX; + let X; + //String format : numOfX + " " + X + " " + "ago" + let timeLapsed; + + const date1 = new Date(`${year}/${month}/${day} ${hour}:${minute}:${second}`); + const date2 = new Date(`${currYear}/${currMonth}/${currDay} ${currHour}:${currMinute}:${currSeconds}` + ); + + let oldTime; + let diffInMilliSeconds = date2 - date1; + let newTime = diffInMilliSeconds / 1000; + + + let index = 0; + let divFac = [60, 60, 24, 7, 4, 12]; + let XFac = ["minutes", "hours", "days", "weeks", "months", "years"]; + + while (Math.floor(newTime / divFac[index]) != 0 && index < divFac.length) { + oldTime = newTime; + newTime = Math.floor(newTime / divFac[index]); + + numOfX = newTime; + X = XFac[index]; + index++; + } + + if (numOfX < 2 && X == "weeks") { + numOfX = oldTime; + X = "days"; + } + + if (numOfX == 1) { + X = X.slice(0, -1); + } + + timeLapsed = `${numOfX} ${X} ago`; + + return timeLapsed; +}; + + diff --git a/explore.html b/explore.html index f9b924e..d5459f5 100644 --- a/explore.html +++ b/explore.html @@ -1,30 +1,122 @@ - - YouTube - - - + + YouTube - - + + + - - - - + + - - - - - - + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + + - - - +
+
+
+ + + + +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + \ No newline at end of file