From 1d38db94ddce542a30197fadd9b3c4d0ae7b1a30 Mon Sep 17 00:00:00 2001 From: Rohit Date: Sat, 31 Aug 2024 22:28:57 +0530 Subject: [PATCH] feature/aside-news-section-added --- app/(root)/(pages)/blog/page.tsx | 5 +- components/custom/asides/NewsAsideSection.tsx | 128 ++++++++++++++++++ .../home => asides}/PrimaryAsideSection.tsx | 0 components/custom/cards/NewsSmallCard.tsx | 35 +++++ tailwind.config.ts | 2 +- 5 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 components/custom/asides/NewsAsideSection.tsx rename components/custom/{pages/home => asides}/PrimaryAsideSection.tsx (100%) create mode 100644 components/custom/cards/NewsSmallCard.tsx diff --git a/app/(root)/(pages)/blog/page.tsx b/app/(root)/(pages)/blog/page.tsx index 0f694ad..40b7ac4 100644 --- a/app/(root)/(pages)/blog/page.tsx +++ b/app/(root)/(pages)/blog/page.tsx @@ -1,7 +1,8 @@ import React from 'react'; import BlogsList from "@/components/lists/BlogsList"; -import PrimaryAsideSection from "@/components/custom/pages/home/PrimaryAsideSection"; +import PrimaryAsideSection from "@/components/custom/asides/PrimaryAsideSection"; import InformationFooter from "@/components/InformationFooter"; +import NewsAsideSection from "@/components/custom/asides/NewsAsideSection"; export const metadata = { title: "Home - Bloggios", @@ -20,7 +21,7 @@ export default function DashboardPage() { ) diff --git a/components/custom/asides/NewsAsideSection.tsx b/components/custom/asides/NewsAsideSection.tsx new file mode 100644 index 0000000..1874468 --- /dev/null +++ b/components/custom/asides/NewsAsideSection.tsx @@ -0,0 +1,128 @@ +import React, {useCallback} from 'react'; +import {useQuery} from "@tanstack/react-query"; +import {loggedInUserProfile} from "@/rest/UserAuthProviderApplication"; +import {Card, CardBody, CardFooter, CardHeader} from "@nextui-org/card"; +import {Skeleton} from "@/components/ui/skeleton"; +import {Button, Divider} from "@nextui-org/react"; +import LoggedInUserAvatar from "@/components/custom/user/LoggedInUserAvatar"; +import Image from "next/image"; +import BorderedLogoutButton from "@/components/custom/buttons/BorderedLogoutButton"; +import {BiRefresh} from "react-icons/bi"; +import NewsSmallCard from "@/components/custom/cards/NewsSmallCard"; + +const newsList = [ + { + "id": 1, + "title": "Tech Giants Embrace AI: Companies Ramp Up Investments in Artificial Intelligence to Revolutionize Industries", + "posted": "10h ago" + }, + { + "id": 2, + "title": "Climate Crisis Intensifies: Record-Breaking Heatwaves and Floods Displace Millions Globally, Urging Immediate Action", + "posted": "5h ago" + }, + { + "id": 3, + "title": "Economic Uncertainty: Global Markets Tumble Amid Rising Inflation and Interest Rate Hikes", + "posted": "8h ago" + }, + { + "id": 4, + "title": "Groundbreaking Medical Discovery: New Cancer Treatment Shows Promising Results in Early Trials", + "posted": "1d ago" + }, + { + "id": 5, + "title": "Innovations in Renewable Energy: Solar and Wind Power Set to Surpass Fossil Fuels by 2030", + "posted": "2h ago" + }, + { + "id": 6, + "title": "Data Privacy Concerns Rise: Governments and Tech Companies Clash Over Encryption and User Data Access", + "posted": "3h ago" + }, + { + "id": 7, + "title": "Space Exploration Milestone: Private Company Successfully Launches First Commercial Space Station", + "posted": "12h ago" + }, + { + "id": 8, + "title": "Digital Nomad Trend Grows: Remote Work Revolution Drives Demand for Flexible Living and Co-Working Spaces Worldwide", + "posted": "7h ago" + }, + { + "id": 9, + "title": "Global Chip Shortage Persists: Automakers and Tech Firms Struggle to Meet Demand as Supply Chain Issues Continue", + "posted": "15m ago" + }, + { + "id": 10, + "title": "Breakthrough in Quantum Computing: Scientists Achieve New Levels of Speed and Accuracy, Opening Doors to Unprecedented Capabilities", + "posted": "4h ago" + } +]; + +const NewsAsideSection = () => { + + return ( + + + + ); +}; + +const NewsAsideSkeleton = () => { + return ( +
+ +
+ + +
+ + + +
+ ) +}; + +const NewsCard = () => { + return ( + <> + +

+ Bloggios Stories +

+
+ + + {newsList.map((item) => ( + <> + + + ))} + + + ) +} + +const NewAsideError = () => { + return ( +
+
+

Something went Wrong

+ Refresh Page +
+ +
+ ) +} + +export default NewsAsideSection; \ No newline at end of file diff --git a/components/custom/pages/home/PrimaryAsideSection.tsx b/components/custom/asides/PrimaryAsideSection.tsx similarity index 100% rename from components/custom/pages/home/PrimaryAsideSection.tsx rename to components/custom/asides/PrimaryAsideSection.tsx diff --git a/components/custom/cards/NewsSmallCard.tsx b/components/custom/cards/NewsSmallCard.tsx new file mode 100644 index 0000000..7a0e9a2 --- /dev/null +++ b/components/custom/cards/NewsSmallCard.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import {Tooltip} from "@nextui-org/react"; + +const NewsSmallCard = ({ + id, + title, + posted + }: { + id: string | number, + title: string, + posted: string +}) => { + return ( + + {title} + Posted : {posted} + + } + > +
+ {title} + Posted : {posted} +
+
+ ); +}; + +export default NewsSmallCard; \ No newline at end of file diff --git a/tailwind.config.ts b/tailwind.config.ts index bca9ded..5af7b83 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -4,7 +4,7 @@ import type {Config} from "tailwindcss" const config = { darkMode: ["class"], content: [ - "./(pages)/**/*.{ts,tsx}", + "./(asides)/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}", "./src/**/*.{ts,tsx}",