fix:banner

This commit is contained in:
Rama Priyanto 2025-05-26 13:07:26 +07:00
parent 2f3b6cb027
commit 3d9975cbcb
3 changed files with 18 additions and 16 deletions

View File

@ -70,7 +70,7 @@ export default function HeaderNews() {
search: "", search: "",
limit: "10", limit: "10",
sort: "desc", sort: "desc",
category: "1906", categoryByIds: "791802",
isPublish: true, isPublish: true,
}; };
const response = await getListArticle(req); const response = await getListArticle(req);
@ -81,7 +81,7 @@ export default function HeaderNews() {
<div className="w-full"> <div className="w-full">
<div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto"> <div className="flex flex-col lg:flex-row gap-3 lg:gap-8 bg-white dark:bg-black p-1 lg:p-8 lg:h-[540px] w-full lg:w-[75%] lg:mx-auto">
<div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto"> <div className="lg:hidden w-[90%] h-[300px] md:h-[500px] mx-auto">
{banner ? ( {hotNews ? (
<Swiper <Swiper
centeredSlides={true} centeredSlides={true}
autoplay={{ autoplay={{
@ -108,7 +108,7 @@ export default function HeaderNews() {
); );
}} }}
> >
{banner?.map((newsItem: any, index: number) => ( {hotNews?.map((newsItem: any, index: number) => (
<SwiperSlide key={newsItem?.id}> <SwiperSlide key={newsItem?.id}>
<Card <Card
radius="lg" radius="lg"
@ -213,7 +213,7 @@ export default function HeaderNews() {
</div> </div>
<div className="hidden lg:flex w-full lg:w-[50%] h-[500px]"> <div className="hidden lg:flex w-full lg:w-[50%] h-[500px]">
{banner ? ( {hotNews ? (
<Swiper <Swiper
centeredSlides={true} centeredSlides={true}
autoplay={{ autoplay={{
@ -263,7 +263,7 @@ export default function HeaderNews() {
href={`news/detail/${newsItem.id}-${newsItem?.slug}`} href={`news/detail/${newsItem.id}-${newsItem?.slug}`}
> >
<p className="text-left font-semibold text-lg lg:text-2xl"> <p className="text-left font-semibold text-lg lg:text-2xl">
{newsItem.title} {textEllipsis(newsItem.title, 40)}
</p> </p>
</Link> </Link>
<div className="flex flex-row gap-1"> <div className="flex flex-row gap-1">
@ -316,7 +316,10 @@ export default function HeaderNews() {
className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md" className="text-xs text-left m-2 p-2 dark:bg-[#1E1616] bg-white rounded-md"
> >
<Link href={`news/detail/${list?.id}`}> <Link href={`news/detail/${list?.id}`}>
<p className="text-left font-semibold">{list?.title}</p> <p className="text-left font-semibold">
{" "}
{textEllipsis(list.title, 120)}
</p>
</Link> </Link>
<div className="flex flex-row gap-1"> <div className="flex flex-row gap-1">
<p className="py-[2px] text-left text-xs"> <p className="py-[2px] text-left text-xs">

View File

@ -69,7 +69,7 @@ export default function NewsTicker() {
className="hidden lg:block" className="hidden lg:block"
> >
<p className="text-sm lg:text-base"> <p className="text-sm lg:text-base">
{article[currentNewsIndex]?.title} {textEllipsis(article[currentNewsIndex]?.title, 120)}
</p> </p>
</Link> </Link>
<Link <Link

View File

@ -1,14 +1,12 @@
import { PaginationRequest } from "@/types/globals"; import { PaginationRequest } from "@/types/globals";
import { import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
} from "./http-config/axios-base-service";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import { stat } from "fs"; import { stat } from "fs";
import axiosInterceptorInstanceHumas from "./http-config/konten-humas-base-service"; import axiosInterceptorInstanceHumas from "./http-config/konten-humas-base-service";
import { httpGetInterceptor } from "./http-config/http-interceptor-services"; import {
httpDeleteInterceptor,
httpGetInterceptor,
} from "./http-config/http-interceptor-services";
const token = Cookies.get("access_token"); const token = Cookies.get("access_token");
export async function getListArticle(props: PaginationRequest) { export async function getListArticle(props: PaginationRequest) {
@ -121,8 +119,9 @@ export async function getArticleById(id: any) {
export async function deleteArticle(id: string) { export async function deleteArticle(id: string) {
const headers = { const headers = {
"content-type": "application/json", "content-type": "application/json",
Authorization: `Bearer ${token}`,
}; };
return await httpDeleteInterceptor(`articles/${id}`, headers); return await httpDeleteInterceptor(`articles/${id}`);
} }
export async function getArticleByCategory() { export async function getArticleByCategory() {
@ -160,7 +159,7 @@ export async function deleteArticleFiles(id: number) {
const headers = { const headers = {
"content-type": "multipart/form-data", "content-type": "multipart/form-data",
}; };
return await httpDeleteInterceptor(`article-files/${id}`, headers); return await httpDeleteInterceptor(`article-files/${id}`);
} }
export async function getUserLevelDataStat(startDate: string, endDate: string) { export async function getUserLevelDataStat(startDate: string, endDate: string) {