diff --git a/next.config.js b/next.config.js index 3176fc1..1f9211d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,9 +1,8 @@ -const withMDX = require('@next/mdx')(); - /** @type {import('next').NextConfig} */ const nextConfig = { - output: "export", - images: { unoptimized: true } + images: { + domains: ['tetragram.codered.cloud'], + }, } -module.exports = nextConfig; +module.exports = nextConfig \ No newline at end of file diff --git a/public/man-avatar-clipart-illustration-free-png.webp b/public/man-avatar-clipart-illustration-free-png.webp new file mode 100644 index 0000000..19352e2 Binary files /dev/null and b/public/man-avatar-clipart-illustration-free-png.webp differ diff --git a/src/app/blogs/Blogcard.js b/src/app/blogs/Blogcard.js index 52faa12..89e016a 100644 --- a/src/app/blogs/Blogcard.js +++ b/src/app/blogs/Blogcard.js @@ -1,5 +1,28 @@ +// 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 ( +
+
+
+

{title}

+
+
+
+ ); +}; + +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, date }) => { @@ -21,5 +44,3 @@ const BlogCard = ({ title, authors, img, description, slug, date }) => { }; export default BlogCard; - -// src/components/BlogCard.js \ No newline at end of file diff --git a/src/app/blogs/[blogid]/page.js b/src/app/blogs/[blogid]/page.js new file mode 100644 index 0000000..ff4d631 --- /dev/null +++ b/src/app/blogs/[blogid]/page.js @@ -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 ( + <> + +
+ +
+ {blogData ? ( +
+

{blogData.title}

+ {blogData.blog_body} +
+ ) : ( +

Loading...

+ )} +
+
+