152 lines
6.1 KiB
TypeScript
152 lines
6.1 KiB
TypeScript
"use client";
|
||
|
||
import React, { useEffect, useState } from "react";
|
||
import { getNews } from "@/utils/commonApi";
|
||
import { useQuery } from "@tanstack/react-query";
|
||
import Image from "next/image";
|
||
import Link from "next/link";
|
||
|
||
export default function News() {
|
||
const { data, isLoading, isError, refetch } = useQuery({
|
||
queryKey: ["News"],
|
||
queryFn: () => getNews(),
|
||
refetchOnWindowFocus: false,
|
||
});
|
||
console.log(data);
|
||
|
||
if (isLoading) {
|
||
return <p>Loading...</p>;
|
||
}
|
||
if (isError) {
|
||
return <p>Error fetching content.</p>;
|
||
}
|
||
|
||
return (
|
||
<div className="bg-white dark:bg-gray-900 w-screen pt-8">
|
||
<div className="container w-full flex flex-wrap lg:flex-row gap-8 mb-14 flex-col max-lg:gap-4">
|
||
|
||
{/* {data.map((item: any, index: number) => {
|
||
return <p key={index}>News</p>;
|
||
})} */}
|
||
|
||
<div
|
||
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||
>
|
||
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||
<Image
|
||
alt="picture"
|
||
src="/img/pic1.png"
|
||
height={500}
|
||
width={500}
|
||
quality={100}
|
||
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||
/>
|
||
</div>
|
||
|
||
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||
اخبار
|
||
</p>
|
||
<p className="text-xs font-medium text-right text-black">
|
||
24 آذر ماه 1402
|
||
</p>
|
||
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||
شروع به کار سامانه عیون
|
||
</p>
|
||
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||
...
|
||
</p>
|
||
<Link
|
||
href="#"
|
||
className="text-[10px] font-normal text-blue text-left"
|
||
>
|
||
بیشتر بخوانید{" "}
|
||
</Link>
|
||
</div>
|
||
</div>
|
||
|
||
<div
|
||
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||
>
|
||
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||
<Image
|
||
alt="picture"
|
||
src="/img/pic1.png"
|
||
height={500}
|
||
width={500}
|
||
quality={100}
|
||
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||
/>
|
||
</div>
|
||
|
||
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||
اخبار
|
||
</p>
|
||
<p className="text-xs font-medium text-right text-black">
|
||
24 آذر ماه 1402
|
||
</p>
|
||
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||
شروع به کار سامانه عیون
|
||
</p>
|
||
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||
...
|
||
</p>
|
||
<Link
|
||
href="#"
|
||
className="text-[10px] font-normal text-blue text-left"
|
||
>
|
||
بیشتر بخوانید{" "}
|
||
</Link>
|
||
</div>
|
||
</div>
|
||
|
||
<div
|
||
className=" w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||
>
|
||
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||
<Image
|
||
alt="picture"
|
||
src="/img/pic1.png"
|
||
height={500}
|
||
width={500}
|
||
quality={100}
|
||
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||
/>
|
||
</div>
|
||
|
||
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||
اخبار
|
||
</p>
|
||
<p className="text-xs font-medium text-right text-black">
|
||
24 آذر ماه 1402
|
||
</p>
|
||
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||
شروع به کار سامانه عیون
|
||
</p>
|
||
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||
...
|
||
</p>
|
||
<Link
|
||
href="#"
|
||
className="text-[10px] font-normal text-blue text-left"
|
||
>
|
||
بیشتر بخوانید{" "}
|
||
</Link>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|