From d2af12f67fe59424fa3452db444a29bbf7769069 Mon Sep 17 00:00:00 2001 From: Ayush <99096397+ayush4345@users.noreply.github.com> Date: Tue, 27 Feb 2024 19:53:04 +0530 Subject: [PATCH] major changes in styling --- src/app/blogs/Blogcard.js | 22 +++-- src/app/blogs/Blogcard.module.css | 8 +- src/app/blogs/[blogid]/page.js | 66 +++++++++---- src/app/blogs/page.js | 71 +++++--------- src/app/events/Eventcard.module.css | 8 +- src/app/events/[blogid]/page.js | 63 ------------- src/app/events/[eventid]/page.js | 88 ++++++++++++++++++ .../{[blogid] => [eventid]}/styleblog.css | 0 src/app/events/eventCard.js | 22 +++-- src/app/events/page.js | 53 +++++------ src/app/globals.css | 2 +- src/app/iet/page.js | 1 - src/app/layout.js | 2 + src/app/page.js | 1 - ...-avatar-clipart-illustration-free-png.webp | Bin src/app/{team => teams}/page.js | 5 +- src/app/{team => teams}/styles.css | 0 src/app/{team => teams}/th.jpeg | Bin src/components/Navbar/Navbar.js | 7 +- src/components/Navbar/Navbar.module.css | 38 ++++++-- src/components/ProjectCard.js | 20 ++-- src/components/ProjectsPage.js | 33 ++++--- src/components/about.js | 4 +- src/components/hero.js | 8 +- src/components/sig.js | 6 +- tailwind.config.js | 9 ++ 26 files changed, 315 insertions(+), 222 deletions(-) delete mode 100644 src/app/events/[blogid]/page.js create mode 100644 src/app/events/[eventid]/page.js rename src/app/events/{[blogid] => [eventid]}/styleblog.css (100%) rename src/app/{team => teams}/man-avatar-clipart-illustration-free-png.webp (100%) rename src/app/{team => teams}/page.js (98%) rename src/app/{team => teams}/styles.css (100%) rename src/app/{team => teams}/th.jpeg (100%) diff --git a/src/app/blogs/Blogcard.js b/src/app/blogs/Blogcard.js index ff13dba..70e2958 100644 --- a/src/app/blogs/Blogcard.js +++ b/src/app/blogs/Blogcard.js @@ -6,17 +6,19 @@ const BlogCard = ({ title, authors, img, description, slug, date }) => { // const truncatedDescription = description.length > 100 ? `${description.slice(0, 100)}...` : description; return ( -
-
- {title} + +
+
+ {title} +
+
+

{title}

+

{date}

+

by {authors}

+

{description.slice(0, 150) + "... see more"}

+
-
-

{title}

-

{date}

-

by {authors}

-

{description.slice(0, 150) + "... see more"}

-
-
+ ); }; diff --git a/src/app/blogs/Blogcard.module.css b/src/app/blogs/Blogcard.module.css index 008fa8f..ab2bbfc 100644 --- a/src/app/blogs/Blogcard.module.css +++ b/src/app/blogs/Blogcard.module.css @@ -16,7 +16,7 @@ } .blogCard { - width: 350px; + width: 320px; height: fit-content; border: 1px solid #e0e0e0; border-radius: 8px; @@ -29,6 +29,12 @@ height: 100%; } +@media screen and (max-width: 350px) { + .blogCard { + width: 100%; + } +} + .blogCcard:hover { transform: scale(1.02); } diff --git a/src/app/blogs/[blogid]/page.js b/src/app/blogs/[blogid]/page.js index ff4d631..ad85483 100644 --- a/src/app/blogs/[blogid]/page.js +++ b/src/app/blogs/[blogid]/page.js @@ -21,13 +21,13 @@ const BlogId = ({ params }) => { // 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); + console.log("check", data); // Find the blog post with the matching id - const matchingBlog = data.items.find(blog => blog.id === parseInt(params.blogid)); - + const matchingBlog = data.items.find(blog => blog?.meta.slug === params.blogid); + console.log("matchingBlog", data.items[0]); // Update the state with the matching blog data setBlogData(matchingBlog); - console.log("blog :",matchingBlog.blog_img_url) + console.log("blog :", matchingBlog.blog_img_url) } catch (error) { console.error('Error fetching data:', error); @@ -36,26 +36,54 @@ const BlogId = ({ params }) => { // Call the fetchData function fetchData(); - }, [params.id]); // Include params.id in the dependency array to refetch data when id changes + }, [params.blogid]); // Include params.id in the dependency array to refetch data when id changes + console.log(blogData?.blog_tags.split(",")) + + let inputDate = blogData?.published_on; + let dateObj = new Date(inputDate); + let day = dateObj.getDate(); + let month = dateObj.toLocaleString('default', { month: 'short' }); + let year = dateObj.getFullYear(); + + let formattedDate = `${day} ${month} ${year}`; // Render the component return ( <> - -
- -
- {blogData ? ( -
-

{blogData.title}

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

Loading...

- )} + +
+
+ {blogData ? ( +
+
+
+
+ {blogData?.blog_tags.split(",").map((data, index) => { + return ( + {data} + ) + } + )} +
+
+ {blogData.title} +
+
+ {blogData.blog_description} +
+
+ {blogData.blog_authors}{formattedDate} +
+
+
+ {blogData.blog_body} +
+ ) : ( +

Loading...

+ )} +
-
-