Kahdooei
Hossein Rahmani 2024-01-24 15:31:39 +03:30
commit 1e0ca5c229
8 changed files with 235 additions and 17 deletions

6
app/AboutUs/page.tsx Normal file
View File

@ -0,0 +1,6 @@
import AboutUs from "@/components/AboutUs";
import React from "react";
export default function page() {
return <AboutUs />;
}

8
app/News/page.tsx Normal file
View File

@ -0,0 +1,8 @@
import News from '@/components/News'
import React from 'react'
export default function page() {
return (
<News />
)
}

View File

@ -19,7 +19,7 @@ import "swiper/css/pagination";
import { Autoplay, Pagination, Navigation } from "swiper/modules"; import { Autoplay, Pagination, Navigation } from "swiper/modules";
import { sliderItems } from "@/constants"; import { sliderItems } from "@/constants";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { getSliders } from "@/utils/commonApi"; import { getSliders , getNews} from "@/utils/commonApi";
export default function Landing() { export default function Landing() {
const { data, isLoading, refetch } = useQuery({ const { data, isLoading, refetch } = useQuery({
@ -27,9 +27,15 @@ export default function Landing() {
queryFn: () => getSliders(), queryFn: () => getSliders(),
refetchOnWindowFocus: false, refetchOnWindowFocus: false,
}); });
console.log(data); console.log(data);
const { data:NewsData, isLoading:NewsisLoading, isError:NewsisError, refetch:Newsrefetch } = useQuery({
queryKey: ["News"],
queryFn: () => getNews(),
refetchOnWindowFocus: false,
});
console.log("NewsData"+ NewsData);
return ( return (
<div className="overflow-x-hidden max-md:-mt-8"> <div className="overflow-x-hidden max-md:-mt-8">
<div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]"> <div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]">
@ -160,10 +166,7 @@ export default function Landing() {
آخرین اخبار آخرین اخبار
</div> </div>
<div <div
className=" w-full mt-6 flex flex-row gap-8 mb-14 className=" w-full mt-6 flex flex-row gap-8 mb-14 max-lg:flex-col max-lg:gap-4 ">
max-lg:flex-col max-lg:gap-4
"
>
{/* Right News */} {/* Right News */}
<div <div
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all

41
components/AboutUs.tsx Normal file
View File

@ -0,0 +1,41 @@
"use client";
import React, { useEffect, useState } from "react";
import { getSingleWebContents } from "@/utils/commonApi";
import { useQuery } from "@tanstack/react-query";
export default function AboutUs() {
const [title, setTitle] = useState("AboutUs");
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["WebContents", title],
queryFn: () => getSingleWebContents(title),
refetchOnWindowFocus: false,
});
console.log(data);
useEffect(() => {
refetch();
}, [title, refetch]);
if (isLoading) {
return <p>Loading...</p>;
}
if (isError) {
return <p>Error fetching content.</p>;
}
const fetchedContent = data?.content || ""; // Assuming your API response has a 'content' property
return (
<div className="bg-white dark:bg-gray-900 w-screen pt-8">
<div
className="container flex font-[yekan]
text-[#7C838A] dark:text-white text-base font-medium leading-6 tracking-wide 3xl:text-lg 3xl:font-bold"
>
{/* Display fetched content */}
<div dangerouslySetInnerHTML={{ __html: fetchedContent }} />
</div>
</div>
);
}

View File

@ -50,7 +50,7 @@ export default function CallUs(props: any) {
{/* </div> */} {/* </div> */}
<div className="container flex items-center h-[90vh]"> <div className="container flex items-center h-[90vh]">
<div className="grid gap-8 md:gap-0 grid-cols-1 md:grid-cols-3 md:h-[40vh] h-full w-full lg:px-32 xl:px-52 md:py-8 py-12"> <div className="grid gap-8 md:gap-0 grid-cols-1 md:grid-cols-2 md:h-[40vh] h-full w-full lg:px-32 xl:px-52 md:py-8 py-12">
{callUsItems.map((item) => { {callUsItems.map((item) => {
return ( return (
<div <div

151
components/News.tsx Normal file
View File

@ -0,0 +1,151 @@
"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>
);
}

View File

@ -5,8 +5,8 @@ import bgimg from "../public/img/bg.png";
export const menuItems = [ export const menuItems = [
{ id: 1, name: "صفحه اصلی", href: "/" }, { id: 1, name: "صفحه اصلی", href: "/" },
{ id: 2, name: "اخبار", href: "/" }, { id: 2, name: "اخبار", href: "/News" },
{ id: 3, name: "درباره ما", href: "/" }, { id: 3, name: "درباره ما", href: "/AboutUs" },
{ id: 4, name: "تماس با ما", href: "/CallUs" }, { id: 4, name: "تماس با ما", href: "/CallUs" },
{ id: 5, name: "پیگیری", href: "/FollowUp" }, { id: 5, name: "پیگیری", href: "/FollowUp" },
{ id: 6, name: "ورود به پنل کاربری", href: "/Login" }, { id: 6, name: "ورود به پنل کاربری", href: "/Login" },
@ -106,13 +106,13 @@ export const footerItems = [
]; ];
export const callUsItems = [ export const callUsItems = [
{ // {
id: 1, // id: 1,
title: "نشانی", // title: "نشانی",
icon: <LuMapPin size="full" />, // icon: <LuMapPin size="full" />,
description: " نشانی ما جهت ارتباط ", // description: " نشانی ما جهت ارتباط ",
description2: "google map", // description2: "google map",
}, // },
{ {
id: 2, id: 2,
title: "نشانی الکترونیک", title: "نشانی الکترونیک",

View File

@ -36,3 +36,12 @@ export async function getSingleWebContents( title: string ) {
console.log(data); console.log(data);
return data.data; return data.data;
} }
// News
export async function getNews() {
const data = await axios.get("api/Common/News");
console.log(data);
return data.data;
}