fix/home_page-and-fix/footer

parent cbfd9322
import { NewsAdminItem } from '@/api/types/news' import { NewsAdminItem } from "@/api/types/news";
import BASE_URL from '@/links' import BASE_URL from "@/links";
import dayjs from 'dayjs'; import dayjs from "dayjs";
import AppEditorContent from '@/components/shared/editor-content'; import AppEditorContent from "@/components/shared/editor-content";
function CardNews({ news }: { news: NewsAdminItem }) { function CardNews({ news }: { news: NewsAdminItem }) {
return ( return (
<a <a
href={`${news.id}`} href={`${news.id}`}
className='flex flex-row gap-2 mb-2 sm:gap-3 sm:mb-3 p-2 sm:p-3 border border-gray-200 bg-white rounded-md' className="flex flex-row gap-2 mb-2 sm:gap-3 sm:mb-3"
> >
<img <img
src={`${BASE_URL.imageEndpoint}${news.thumbnail}`} src={`${BASE_URL.imageEndpoint}${news.thumbnail}`}
alt={news.title} alt={news.title}
className='w-[100px] md:w-[130px] aspect-3/2 object-cover' className="w-[100px] md:w-[130px] aspect-3/2 object-cover"
/> />
<div className='flex-1'> <div className="flex-1">
<p className='text-[#0056b3] font-bold text-sm line-clamp-2'> <p className="text-[#363636] font-bold text-sm line-clamp-2">
{news.title} {news.title}
</p> </p>
<p className='text-gray-500 text-sm my-1'> <p className="text-gray-500 text-sm my-1">
{dayjs(news.release_at).format('DD/MM/YYYY')} {dayjs(news.release_at).format("DD/MM/YYYY")}
</p> </p>
{/* <AppEditorContent className='line-clamp-2' value={news.description} /> */} {/* <AppEditorContent className='line-clamp-2' value={news.description} /> */}
</div> </div>
......
This diff is collapsed.
"use client";
import { useState, useEffect } from "react";
import { ChevronsUp } from "lucide-react";
export default function ScrollToTopButton() {
const [visible, setVisible] = useState(false);
useEffect(() => {
const toggleVisibility = () => {
setVisible(window.scrollY > 300);
};
window.addEventListener("scroll", toggleVisibility);
return () => window.removeEventListener("scroll", toggleVisibility);
}, []);
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: "smooth" });
};
return (
<button
onClick={scrollToTop}
className={`fixed bottom-25 right-6 bg-[#e8c518] hover:text-[#063e8e] text-white p-3 rounded-lg shadow-lg transition-all duration-500 cursor-pointer ${
visible
? "opacity-100 translate-y-0"
: "opacity-0 translate-y-3 pointer-events-none"
}`}
>
<ChevronsUp size={24} />
</button>
);
}
...@@ -170,7 +170,7 @@ function footer() { ...@@ -170,7 +170,7 @@ function footer() {
</div> </div>
</div> </div>
<div className="bg-[#032248] h-[80px] flex items-center justify-center"> <div className="bg-[#032248] h-[80px] flex items-center justify-center">
<div className="max-w-[1200px] w-full p-5"> <div className="container w-full p-5">
<p className="text-[14px] text-white"> <p className="text-[14px] text-white">
© Bản quyền VCCI-HCM | All rights reserved © Bản quyền VCCI-HCM | All rights reserved
</p> </p>
......
import Header from "@/app/(main)/_lib/layout/header" import Header from "@/app/(main)/_lib/layout/header";
import Footer from "@/app/(main)/_lib/layout/footer" import Footer from "@/app/(main)/_lib/layout/footer";
import React from "react"; import React from "react";
import ScrollToTopButton from "./_lib/layout/ScrollToTopButton";
export default function Layout({ export default function Layout({
children, children,
...@@ -10,9 +9,10 @@ export default function Layout({ ...@@ -10,9 +9,10 @@ export default function Layout({
children: React.ReactNode; children: React.ReactNode;
}>) { }>) {
return ( return (
<main className="bg-background"> <main className="flex flex-col min-h-screen bg-background">
<Header /> <Header />
{children} <div className="flex-1">{children}</div>
<ScrollToTopButton />
<Footer /> <Footer />
</main> </main>
); );
......
...@@ -68,7 +68,7 @@ export default function PublicationDetail() { ...@@ -68,7 +68,7 @@ export default function PublicationDetail() {
return ( return (
<div className="bg-[#f6f6f6] min-h-screen"> <div className="bg-[#f6f6f6] min-h-screen">
<div className="max-w-[1200px] mx-auto flex flex-col gap-5 mb-[50px]"> <div className="container mx-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory categories={MEDIA_INFORMATION_CATEGORIES} /> <ListCategory categories={MEDIA_INFORMATION_CATEGORIES} />
</div> </div>
......
...@@ -7,7 +7,7 @@ import PublicationList from "./components/publicationList"; ...@@ -7,7 +7,7 @@ import PublicationList from "./components/publicationList";
export default function Page() { export default function Page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory categories={MEDIA_INFORMATION_CATEGORIES} /> <ListCategory categories={MEDIA_INFORMATION_CATEGORIES} />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Image from "next/image"; ...@@ -6,7 +6,7 @@ import Image from "next/image";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar"; ...@@ -6,7 +6,7 @@ import Calendar from "../components/Calendar";
export default function page() { export default function page() {
return ( return (
<div className="bg-[#f6f6f6]"> <div className="bg-[#f6f6f6]">
<div className="max-w-[1200px] m-auto flex flex-col gap-5 mb-[50px]"> <div className="container m-auto flex flex-col gap-5 mb-[50px]">
<div className="border-[#e5e7f2] border-[1px]"> <div className="border-[#e5e7f2] border-[1px]">
<ListCategory /> <ListCategory />
</div> </div>
......
"use client"; "use client";
import React, { useState } from "react"; import React, { useState } from "react";
import { ArrowRight, ArrowLeft } from "lucide-react"; import { ArrowRight, ArrowLeft } from "lucide-react";
...@@ -66,38 +65,39 @@ export default function EventCalendar() { ...@@ -66,38 +65,39 @@ export default function EventCalendar() {
{d} {d}
</div> </div>
))} ))}
{ {(() => {
(() => { const totalDays = new Date(year, month, 0).getDate();
const totalDays = new Date(year, month, 0).getDate() const firstDayIndex = new Date(year, month - 1, 1).getDay(); // 0 (Sun) - 6 (Sat)
const firstDayIndex = new Date(year, month - 1, 1).getDay() // 0 (Sun) - 6 (Sat)
// previous month total days // previous month total days
const prevMonthTotalDays = new Date(year, month - 1, 0).getDate() const prevMonthTotalDays = new Date(year, month - 1, 0).getDate();
const totalCells = firstDayIndex + totalDays const totalCells = firstDayIndex + totalDays;
const trailingCount = (7 - (totalCells % 7)) % 7 const trailingCount = (7 - (totalCells % 7)) % 7;
return ( return (
<> <>
{Array.from({ length: firstDayIndex }).map((_, i) => { {Array.from({ length: firstDayIndex }).map((_, i) => {
const dayNum = prevMonthTotalDays - (firstDayIndex - 1) + i const dayNum = prevMonthTotalDays - (firstDayIndex - 1) + i;
return ( return (
<div key={`prev-${i}`} className="py-2 text-sm text-gray-300"> <div key={`prev-${i}`} className="py-2 text-sm text-gray-300">
{dayNum} {dayNum}
</div> </div>
) );
})} })}
{Array.from({ length: totalDays }, (_, i) => i + 1).map((day) => { {Array.from({ length: totalDays }, (_, i) => i + 1).map((day) => {
const isHighlighted = mockCalendar.highlighted.includes(day) const isHighlighted = mockCalendar.highlighted.includes(day);
return ( return (
<div <div
key={day} key={day}
className={`py-2 rounded-full w-10 h-10 flex flex-col justify-center items-center text-sm ${ className={`py-2 rounded-full w-10 h-10 flex flex-col justify-center items-center text-sm ${
isHighlighted ? 'bg-yellow-500 text-white' : 'text-gray-700' isHighlighted
? "bg-yellow-500 text-white"
: "text-gray-700"
}`} }`}
> >
{day} {day}
</div> </div>
) );
})} })}
{Array.from({ length: trailingCount }).map((_, i) => ( {Array.from({ length: trailingCount }).map((_, i) => (
...@@ -106,9 +106,8 @@ export default function EventCalendar() { ...@@ -106,9 +106,8 @@ export default function EventCalendar() {
</div> </div>
))} ))}
</> </>
) );
})() })()}
}
</div> </div>
</div> </div>
); );
......
import { FC, JSX } from 'react'; import { FC, JSX } from "react";
import htmlParse, { DOMNode, Element, Text } from 'html-react-parser'; import htmlParse, { DOMNode, Element, Text } from "html-react-parser";
import { AppEditorContentProps } from './AppEditorContent.type'; import { AppEditorContentProps } from "./AppEditorContent.type";
import './AppEditorContent.css'; import "./AppEditorContent.css";
const AppEditorContent: FC<AppEditorContentProps> = ({ value = '', className = '' }) => { const AppEditorContent: FC<AppEditorContentProps> = ({
value = "",
className = "",
}) => {
const transform = (node: DOMNode): JSX.Element | null => { const transform = (node: DOMNode): JSX.Element | null => {
if (node instanceof Element && node.tagName === 'strong') { if (node instanceof Element && node.tagName === "strong") {
return ( return (
<strong className="custom-strong"> <strong className="custom-strong">
{node.children && Array.isArray(node.children) {node.children && Array.isArray(node.children)
? node.children.map((child, index) => { ? node.children.map((child, index) => {
if (typeof child === 'string') { if (typeof child === "string") {
return child; return child;
} else if (child instanceof Text) { } else if (child instanceof Text) {
return child.data; return child.data;
...@@ -26,7 +29,9 @@ const AppEditorContent: FC<AppEditorContentProps> = ({ value = '', className = ' ...@@ -26,7 +29,9 @@ const AppEditorContent: FC<AppEditorContentProps> = ({ value = '', className = '
return ( return (
<div className="jodit-container app-editor-container"> <div className="jodit-container app-editor-container">
<div className={`jodit-wysiwyg ${className}`}>{htmlParse(value, { replace: transform })}</div> <div className={`jodit-wysiwyg ${className}`}>
{htmlParse(value, { replace: transform })}
</div>
</div> </div>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment