news section added

This commit is contained in:
Batyr 2025-05-21 16:03:40 +05:00
parent e2ccae0fa7
commit 51792851db
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,30 @@
import { FC } from "react";
import { cn } from "@/lib/utils";
import { Loader } from "../loader";
import { useLangStore } from "@/store/lang";
import { useNews } from "@/hooks/tanstack/use-news";
import { NewsCard } from "../news-card";
import { Container } from "@/components/layout";
export const HomeNews: FC = () => {
const lang = useLangStore((state) => state.lang);
const { data, isPending } = useNews(lang);
if (isPending) return <Loader />;
return (
<section className={cn("md:mb-[120px] mb-20")}>
<Container>
<h2 className="h2 text-center md:mb-8 mb-6">
{lang === "en" ? "News" : "Новости"}
</h2>
<div className="grid md:grid-cols-3 grid-cols-1 gap-6">
{data?.map((item) => (
<NewsCard {...item} key={item.title} />
))}
</div>
</Container>
</section>
);
};

View File

@ -6,6 +6,7 @@ import {
HomeTheme, HomeTheme,
HomeTime, HomeTime,
} from "@/components/shared"; } from "@/components/shared";
import { HomeNews } from "@/components/shared/home/home-news";
export default function Home() { export default function Home() {
return ( return (
@ -16,6 +17,7 @@ export default function Home() {
<HomeOffers /> <HomeOffers />
<HomeTheme /> <HomeTheme />
<HomeTime /> <HomeTime />
<HomeNews />
</div> </div>
); );
} }