-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Open Youtube channels, query logic, basic templating without st…
…yle #92
- Loading branch information
1 parent
b835bac
commit 5542c42
Showing
5 changed files
with
151 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
// Source: https://tchumim.com/topic/12462/%D7%91%D7%A7%D7%A9%D7%94-%D7%9C%D7%94%D7%9E%D7%9C%D7%A6%D7%95%D7%AA-%D7%A2%D7%9C-%D7%A2%D7%A8%D7%95%D7%A6%D7%99%D7%9D-%D7%A1%D7%A8%D7%98%D7%95%D7%A0%D7%99%D7%9D-%D7%A9%D7%9C-%D7%AA%D7%9B%D7%A0%D7%95%D7%AA-%D7%95%D7%94%D7%9E%D7%A1%D7%AA%D7%A2%D7%A3/22?_=1646950864870 | ||
// Note: The id of the channel has to be provided, check this out in case you only have the custom url (actual name of channel): https://stackoverflow.com/a/16326307/10679649 | ||
|
||
module.exports = [ | ||
{ id: 'channel/UCMgmeSgiQrVkYdJwl2aNe7Q' }, | ||
{ id: 'channel/UCIld0affiSkmp-KkEit3S_w' }, | ||
{ id: 'channel/UC29ju8bIPH5as8OGnQzwJyA' }, | ||
{ id: 'channel/UCW5YeuERMmlnqo4oq8vwUpg' }, | ||
{ id: 'c/programmingwithmosh' }, | ||
{ id: 'c/Freecodecamp' } | ||
{ id: 'UCMgmeSgiQrVkYdJwl2aNe7Q' }, | ||
{ id: 'UCIld0affiSkmp-KkEit3S_w' }, | ||
{ id: 'UC29ju8bIPH5as8OGnQzwJyA' }, | ||
{ id: 'UCW5YeuERMmlnqo4oq8vwUpg' }, | ||
{ id: 'UCWv7vMbMWH4-V0ZXdmDpPBA' }, | ||
{ id: 'UC8butISFwT-Wl7EV0hUK0BQ' } | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<a target="_blank" :href="`https://www.youtube.com/c/${customUrl}`" :class="{ 'elevation-high': hover }" class="relative w-64 overflow-hidden rounded-md"> | ||
<img style="width: 320px; height: 150px" :src="thumbnail" alt :class="{ 'zoom-in': hover }" class="transition duration-300 rounded-t-md" /> | ||
<div style="height: 150px" class="relative z-10 w-full px-1 py-3 transition duration-300 bg-custom-bg-card"> | ||
<div v-if="isHebrew" class="absolute left-0 z-20 w-10 rounded israel-icon"> | ||
<israel-flag-icon class="bg-custom-bg-card" /> | ||
</div> | ||
<h2 :class="{ 'rtl right-0': doesContainHebrewLetters([title]) }" class="p-2 px-3 text-sm font-light text-custom-text-secondary">{{ title }}</h2> | ||
</div> | ||
<div class="relative"></div> | ||
<div class="z-40"></div> | ||
</a> | ||
</template> | ||
|
||
<script> | ||
import AppLoader from "~/components/UI/AppLoader"; | ||
import IsraelFlagIcon from "~/components/UI/IsraelFlagIcon"; | ||
export default { | ||
props: { | ||
id: String, | ||
title: String, | ||
isHebrew: Boolean, | ||
thumbnail: String, | ||
customUrl: String, | ||
}, | ||
components: { | ||
AppLoader, | ||
IsraelFlagIcon, | ||
}, | ||
data() { | ||
return { | ||
now: new Date(), | ||
hover: false, | ||
}; | ||
}, | ||
methods: { | ||
doesContainHebrewLetters(textArr) { | ||
const HEBREW = RegExp("[\u0590-\u05FF]"); | ||
return textArr.some((txt) => HEBREW.test(txt)); | ||
}, | ||
}, | ||
computed: { | ||
direction() { | ||
return this.doesContainHebrewLetters([this.title]) ? "rtl" : "ltr"; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.israel-icon { | ||
top: -17px; | ||
left: 80%; | ||
} | ||
.zoom-in { | ||
transform: scale(1.02); | ||
} | ||
.elevation-high { | ||
transition: 0.3s ease; | ||
transform: translateY(-1px); | ||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24); | ||
-webkit-box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template> | ||
<div class="flex flex-wrap justify-center max-w-6xl mx-auto mb-24"> | ||
<channel-card v-for="channel in $static.channels.edges" :key="channel.id" :title="channel.node.title" :thumbnail="channel.node.thumbnails.default.url" :custom-url="channel.node.customUrl" /> | ||
</div> | ||
</template> | ||
|
||
<static-query> | ||
{ | ||
channels: allYoutubeChannel { | ||
edges { | ||
node { | ||
id, | ||
title, | ||
description, | ||
customUrl, | ||
thumbnails { | ||
default { | ||
url, | ||
width | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</static-query> | ||
|
||
<script> | ||
import ChannelCard from "@/components/ChannelCard.vue"; | ||
export default { | ||
name: "ChannelList", | ||
components: { | ||
ChannelCard, | ||
}, | ||
mounted() { | ||
console.log(this.$static.channels.edges); | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters