-
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
1 parent
b236634
commit c28935b
Showing
11 changed files
with
359 additions
and
26 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,8 +1,8 @@ | ||
const withMDX = require('@next/mdx')(); | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
output: "export" | ||
images: { | ||
domains: ['tetragram.codered.cloud'], | ||
}, | ||
} | ||
|
||
module.exports = nextConfig; | ||
module.exports = nextConfig |
Binary file not shown.
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,26 +1,51 @@ | ||
// src/components/BlogCard.js | ||
/*import Link from 'next/link'; | ||
import styles from './Blogcard.module.css'; // Use CSS modules for styles | ||
const BlogCard = ({ title, blogLink}) => { | ||
//const truncatedDescription = description.length > 100 ? `${description.slice(0, 100)}...` : description; | ||
return ( | ||
<div className={styles.blogcontainer}> | ||
<div className={styles.blogCard}> | ||
<div className={styles.blogDetails}> | ||
<h2 className={styles.head}>{title}</h2> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default BlogCard; | ||
// src/components/BlogCard.js*/ | ||
|
||
// src/components/BlogCard.js | ||
import Link from 'next/link'; | ||
//import Image from 'next/image'; | ||
import Image from 'next/image'; | ||
import styles from './Blogcard.module.css'; // Use CSS modules for styles | ||
|
||
const BlogCard = ({ title, authors, img, description, slug }) => { | ||
// const truncatedDescription = description.length > 100 ? `${description.slice(0, 100)}...` : description; | ||
const BlogCard = ({ title, blogger, description, blogid,img }) => { | ||
const truncatedDescription = description.length > 300 ? `${description.slice(0, 150)}...` : description; | ||
|
||
return ( | ||
<div className={styles.blogcontainer}> | ||
<div className={styles.blogCard}> | ||
<div className={styles.blogDetails}> | ||
<h2 className={styles.head}>{title}</h2> | ||
<p className={styles.para}>by {authors}</p> | ||
<p className={styles.para}>{description}</p> | ||
<p className={styles.para1}>by {blogger}</p> | ||
<p className={styles.para}>{truncatedDescription}</p> | ||
<br></br> | ||
<Link href={`/blogs/${blogid}`} passHref> | ||
<div className={styles.readMoreButton}>Read More</div> | ||
</Link> | ||
</div> | ||
<div className={styles.blogImage}> | ||
<img className='w-full object-cover' src={img} alt={title} /> | ||
<Image src={img} alt="Blog Image" width={500} height={500}/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BlogCard; | ||
|
||
// src/components/BlogCard.js |
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,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; | ||
|
||
} |
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
Binary file not shown.
Oops, something went wrong.