-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Hilda-Enyioko/hillary
Hillary
- Loading branch information
Showing
10 changed files
with
866 additions
and
644 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBSCRIBE_TOKEN=ab448096-dfd4-4e36-a433-7141de8ce724 |
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
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,20 +1,83 @@ | ||
const hambugerMenu = document.querySelector(".hambuger-menu") | ||
const navMenu = document.querySelector(".nav-menu") | ||
const closeBtn = document.querySelector(".close-button") | ||
const hambugerMenu = document.querySelector(".hambuger-menu"); | ||
const navMenu = document.querySelector(".nav-menu"); | ||
const closeBtn = document.querySelector(".close-button"); | ||
|
||
hambugerMenu.addEventListener("click", () =>{ | ||
navMenu.classList.toggle("active") | ||
}) | ||
hambugerMenu.addEventListener("click", () => { | ||
navMenu.classList.toggle("active"); | ||
}); | ||
|
||
closeBtn.addEventListener("click", () => { | ||
navMenu.classList.toggle("active") | ||
}) | ||
navMenu.classList.toggle("active"); | ||
}); | ||
|
||
const questions = document.querySelectorAll(".the-questions"); | ||
|
||
const questions = document.querySelectorAll(".the-questions") | ||
questions.forEach((questions) => { | ||
questions.addEventListener("click", () => { | ||
questions.classList.toggle("active"); | ||
}); | ||
}); | ||
|
||
questions.forEach(questions => { | ||
questions.addEventListener("click", () => { | ||
questions.classList.toggle("active"); | ||
}) | ||
}) | ||
// Fetching of blog post | ||
document.addEventListener("DOMContentLoaded", () => { | ||
// Function to fetch posts from the API | ||
async function fetchPosts() { | ||
try { | ||
// Send a GET request to the API endpoint | ||
const response = await fetch( | ||
"https://inclusive-talks.vercel.app/api/trpc/getAllPost" | ||
); | ||
console.log(response); | ||
|
||
// Check if the request was successful | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! Status: ${response.status}`); | ||
} | ||
|
||
// Parse the JSON response | ||
const res = await response.json(); | ||
console.log({ res }); | ||
const { data } = res.result; | ||
console.log(data); | ||
|
||
const postsContainer = document.getElementById("posts-container"); | ||
|
||
// Clear the container | ||
postsContainer.innerHTML = ""; | ||
|
||
// Iterate over the posts and create HTML for each post | ||
data.forEach((post) => { | ||
const postElement = document.createElement("div"); | ||
postElement.className = "blog-section"; | ||
postElement.innerHTML = ` | ||
<div class="blog-post"> | ||
<h1>Blog Posts</h1> | ||
<h2>${post.title}</h2> | ||
<div class="post"> | ||
<div class="post-text"> | ||
<h4>Written By: ${post.writtenBy}</h4> | ||
<p> | ||
${post.text} | ||
<a href="../Blog Page/Gratitude for diversity/post.html" | ||
>CONTINUE READING....</a | ||
> | ||
</p> | ||
</div> | ||
<div class="post-img"> | ||
<img src=${post.imgUrl} alt="" /> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
postsContainer.appendChild(postElement); | ||
}); | ||
} catch (error) { | ||
console.error("Error fetching posts:", error); | ||
} | ||
} | ||
|
||
// Call the fetchPosts function to load the posts when the page loads | ||
fetchPosts(); | ||
}); |
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
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 |
---|---|---|
@@ -1,20 +1,51 @@ | ||
const hambugerMenu = document.querySelector(".hambuger-menu") | ||
const navMenu = document.querySelector(".nav-menu") | ||
const closeBtn = document.querySelector(".close-button") | ||
const hambugerMenu = document.querySelector(".hambuger-menu"); | ||
const navMenu = document.querySelector(".nav-menu"); | ||
const closeBtn = document.querySelector(".close-button"); | ||
|
||
hambugerMenu.addEventListener("click", () =>{ | ||
navMenu.classList.toggle("active") | ||
}) | ||
hambugerMenu.addEventListener("click", () => { | ||
navMenu.classList.toggle("active"); | ||
}); | ||
|
||
closeBtn.addEventListener("click", () => { | ||
navMenu.classList.toggle("active") | ||
}) | ||
navMenu.classList.toggle("active"); | ||
}); | ||
|
||
const questions = document.querySelectorAll(".the-questions"); | ||
|
||
const questions = document.querySelectorAll(".the-questions") | ||
questions.forEach((questions) => { | ||
questions.addEventListener("click", () => { | ||
questions.classList.toggle("active"); | ||
}); | ||
}); | ||
|
||
questions.forEach(questions => { | ||
questions.addEventListener("click", () => { | ||
questions.classList.toggle("active"); | ||
}) | ||
}) | ||
// slide show | ||
const slides = document.querySelectorAll(".slides"); | ||
const radioButtons = document.querySelectorAll(".radio-btn"); | ||
let currentSlide = 2; | ||
|
||
function showSlide(index) { | ||
slides.forEach((slide, i) => { | ||
slide.classList.remove("active", "inactive"); | ||
radioButtons[i].classList.remove("active"); | ||
if (i === index) { | ||
slide.classList.add("active"); | ||
radioButtons[i].classList.add("active"); | ||
} else if (i === (index + slides.length - 1) % slides.length) { | ||
slide.classList.add("inactive"); | ||
} | ||
}); | ||
} | ||
|
||
function nextSlide() { | ||
currentSlide = (currentSlide + 1) % slides.length; | ||
showSlide(currentSlide); | ||
} | ||
|
||
setInterval(nextSlide, 5000); | ||
|
||
radioButtons.forEach((btn, i) => { | ||
btn.addEventListener("click", () => { | ||
currentSlide = i; | ||
showSlide(currentSlide); | ||
}); | ||
}); |
Oops, something went wrong.