-
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.
- Loading branch information
Showing
14 changed files
with
264 additions
and
29 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.bton { | ||
background-color: purple; | ||
width: fit-content; | ||
color: #fff; | ||
padding: 12px 24px; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
font-size: 16px; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
.bton:hover { | ||
background-color: whitesmoke; | ||
color: purple; | ||
} | ||
|
||
.blogCard { | ||
width: 350px; | ||
height: fit-content; | ||
border: 1px solid #e0e0e0; | ||
border-radius: 8px; | ||
overflow: hidden; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
display: flex; | ||
transition: transform 0.3s ease-in-out; | ||
cursor: pointer; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
|
||
.blogCcard:hover { | ||
transform: scale(1.02); | ||
} | ||
|
||
.blogDetails { | ||
padding: 20px; | ||
width: 100%; /* Adjusted width for details */ | ||
background-color: #f9f9f9; | ||
height: 100%; | ||
} | ||
|
||
.blogImage { | ||
width: 100%; /* Adjusted width for image */ | ||
height: auto; | ||
background-color: #ddd; | ||
background-size: cover; | ||
height: 200px; | ||
} | ||
|
||
.head { | ||
margin-bottom: 10px; | ||
font-size: 1.2rem; | ||
color: #333; | ||
} | ||
|
||
.para { | ||
color: #555; | ||
font-size: small; | ||
} | ||
|
||
.p:last-child { | ||
margin-bottom: 0; | ||
} |
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,6 @@ | ||
.blog-list { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
} | ||
|
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,63 @@ | ||
// Import necessary modules | ||
"use client" | ||
import { useEffect, useState } from "react"; | ||
import Navbar from "@/components/Navbar/Navbar"; | ||
import Footer from "@/components/footer"; | ||
import ReactMarkdown from "react-markdown"; | ||
import './styleblog.css' | ||
// Import Tailwind CSS classes | ||
import 'tailwindcss/tailwind.css'; | ||
|
||
// Component definition | ||
const BlogId = ({ params }) => { | ||
console.log(params.blogid) | ||
// State to store the fetched data | ||
const [blogData, setBlogData] = useState(null); | ||
|
||
// Effect to fetch data when the component mounts | ||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
// Fetch data from the API | ||
const response = await fetch('https://tetragram.codered.cloud/api/v2/pages/?type=blog.BlogPage&fields=*'); | ||
const data = await response.json(); | ||
console.log("check",data); | ||
// Find the blog post with the matching id | ||
const matchingBlog = data.items.find(blog => blog.id === parseInt(params.blogid)); | ||
|
||
// Update the state with the matching blog data | ||
setBlogData(matchingBlog); | ||
console.log("blog :",matchingBlog.blog_img_url) | ||
|
||
} catch (error) { | ||
console.error('Error fetching data:', error); | ||
} | ||
}; | ||
|
||
// Call the fetchData function | ||
fetchData(); | ||
}, [params.id]); // Include params.id in the dependency array to refetch data when id changes | ||
|
||
// Render the component | ||
return ( | ||
<> | ||
|
||
<div className="min-h-screen bg-rose-100 flex items-center justify-center"> | ||
|
||
<div className="max-w-4xl w-full"> | ||
{blogData ? ( | ||
<div> | ||
<h2 className=" mb-2 text-center blogstyle">{blogData.title}</h2> | ||
<ReactMarkdown className="prose pt-3 text-black blogbody p-8 rounded-md shadow-xl z-10">{blogData.blog_body}</ReactMarkdown> | ||
</div> | ||
) : ( | ||
<p>Loading...</p> | ||
)} | ||
</div> | ||
</div> | ||
<Footer /></> | ||
); | ||
}; | ||
|
||
// Export the component | ||
export default BlogId; |
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,18 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Creepster&family=Crimson+Text:ital,wght@1,700&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:wght@900&display=swap'); | ||
|
||
.blogstyle { | ||
font-family: "Montserrat", sans-serif; | ||
font-size: 50px; | ||
font-weight: bold; | ||
font-style: normal; | ||
letter-spacing: 0; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
margin-top: 5.4rem; | ||
} | ||
|
||
.blogbody{ | ||
font-family: "Montserrat", sans-serif; | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,27 @@ | ||
// src/components/BlogCard.js | ||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
import styles from './Eventcard.module.css'; // Use CSS modules for styles | ||
import { CiCalendar } from "react-icons/ci"; | ||
import { IoLocationOutline } from "react-icons/io5"; | ||
import ReactMarkdown from "react-markdown"; | ||
|
||
const BlogCard = ({ title, img, description, slug, date }) => { | ||
// const truncatedDescription = description.length > 100 ? `${description.slice(0, 100)}...` : description; | ||
|
||
return ( | ||
<div className={styles.blogCard}> | ||
<div className={styles.blogImage}> | ||
<img className='w-full object-cover h-52' src={img} alt={title} /> | ||
</div> | ||
<div className={styles.blogDetails}> | ||
<h2 className={`font-semibold ${styles.head}`}>{title}</h2> | ||
<p className='font-medium text-sm mb-1 flex gap-2 items-center'><CiCalendar /> {" "} <span>{date}</span></p> | ||
<p className='font-medium text-sm mb-1 flex gap-2 items-center'><IoLocationOutline /> {" "} <span>SJA</span></p> | ||
<p className={styles.para}>{description.slice(0, 150) + "... see more"}</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BlogCard; |
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,67 @@ | ||
"use client" | ||
import React, { useEffect, useState } from 'react'; | ||
import BlogCard from './eventCard'; | ||
import Footer from '@/components/footer'; | ||
import Navbar from "@/components/Navbar/Navbar"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
CardTitle, | ||
} from '@/components/ui/card'; | ||
|
||
const BlogList = () => { | ||
const [blogs, setBlogs] = useState([]); | ||
const [currentPage, setCurrentPage] = useState(1); | ||
const blogsPerPage = 6; | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const response = await fetch('https://tetragram.codered.cloud/api/v2/pages/?type=events.EventsPage&fields=*'); | ||
const data = await response.json(); | ||
setBlogs(data.items); | ||
} catch (error) { | ||
console.error('Error fetching data:', error); | ||
} | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
|
||
// Calculate the index range for the current page | ||
const indexOfLastBlog = currentPage * blogsPerPage; | ||
const indexOfFirstBlog = indexOfLastBlog - blogsPerPage; | ||
const currentBlogs = blogs.slice(indexOfFirstBlog, indexOfLastBlog); | ||
|
||
// Function to handle page change | ||
const handlePageChange = (newPage) => { | ||
setCurrentPage(newPage); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className='mt-4 py-4 p-5 md:p-10 md:py-4 grid gap-5 grid-cols-1 md:grid-cols-2 xl:p-20 xl:py-4 lg:grid-cols-3 2xl:grid-cols-4'> | ||
{blogs.map((blog, index) => { | ||
return ( | ||
<> | ||
<BlogCard | ||
key={index} | ||
title={blog.title} | ||
organizer={blog.event_organizer} | ||
img="https://images.unsplash.com/photo-1549451371-64aa98a6f660?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" | ||
description="A fun-filled event to bring out the gamer in you and compete to be the best gamer out there. Register in teams of 5 or individually and showcase your gaming talent! Individual registrants will be teamed up with other individual registrants to form teams of 5." | ||
slug={blog.event_slug} | ||
date={blog.event_date} | ||
/> | ||
</> | ||
) | ||
})} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default BlogList; |
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