update
This commit is contained in:
@@ -3,10 +3,9 @@
|
||||
import React, { useEffect, useState, useSyncExternalStore } from 'react';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import { FaMapMarkerAlt, FaBars } from 'react-icons/fa';
|
||||
import { FaBars, FaMapMarkerAlt } from 'react-icons/fa';
|
||||
import BoxShowroom from '@/components/Common/BoxShowroom';
|
||||
import BoxHotLine from '../../BoxHotline';
|
||||
|
||||
import { formatCurrency } from '@/lib/formatPrice';
|
||||
import {
|
||||
getServerCartSnapshot,
|
||||
@@ -33,7 +32,7 @@ const HeaderMid: React.FC = () => {
|
||||
const cartTotal = cart.reduce((sum, item) => sum + Number(item.in_cart.total_price), 0);
|
||||
|
||||
const openModal = (id: string) => {
|
||||
(document.getElementById(id) as HTMLDialogElement)?.showModal();
|
||||
(document.getElementById(id) as HTMLDialogElement | null)?.showModal();
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -43,19 +42,21 @@ const HeaderMid: React.FC = () => {
|
||||
<Link href="/">
|
||||
<Image
|
||||
src="https://nguyencongpc.vn/media/lib/18-02-2025/logowhite-dfvefb.png"
|
||||
width="170"
|
||||
height="38"
|
||||
alt="logo"
|
||||
width={170}
|
||||
height={38}
|
||||
alt="Nguyễn Công PC"
|
||||
className="logo-header"
|
||||
/>
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="icon-showroom flex items-center justify-center"
|
||||
onClick={() => openModal('boxShowroom')}
|
||||
>
|
||||
<FaMapMarkerAlt size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="header-middle-right flex items-center">
|
||||
<div className="header-menu-category">
|
||||
<div className="box-title flex items-center justify-center gap-8">
|
||||
@@ -64,6 +65,7 @@ const HeaderMid: React.FC = () => {
|
||||
</div>
|
||||
<div className="cau-noi"></div>
|
||||
</div>
|
||||
|
||||
<div className="header-search-group">
|
||||
<form method="get" action="/tim" name="searchForm">
|
||||
<div className="box-search-input">
|
||||
@@ -99,6 +101,7 @@ const HeaderMid: React.FC = () => {
|
||||
</Link>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openModal('boxHotline')}
|
||||
className="item-tab-header flex flex-col items-center gap-4"
|
||||
>
|
||||
@@ -124,6 +127,7 @@ const HeaderMid: React.FC = () => {
|
||||
<span className="font-medium">Giỏ hàng</span>
|
||||
</Link>
|
||||
<div className="cau-noi"></div>
|
||||
|
||||
<div className="cart-ttip" id="js-cart-tooltip">
|
||||
<div className="cart-ttip-item-container">
|
||||
{cart.map((item) => (
|
||||
@@ -139,6 +143,7 @@ const HeaderMid: React.FC = () => {
|
||||
alt={item.item_info.productName}
|
||||
/>
|
||||
</Link>
|
||||
|
||||
<div className="compare-item-text flex-1">
|
||||
<Link
|
||||
href={item.item_info.productUrl}
|
||||
@@ -146,10 +151,11 @@ const HeaderMid: React.FC = () => {
|
||||
>
|
||||
{item.item_info.productName}
|
||||
</Link>
|
||||
|
||||
<div className="header-cart-item-price flex justify-between">
|
||||
<b>x {item.in_cart.quantity}</b>
|
||||
<b className="price-compare">
|
||||
{item.in_cart.price == '0'
|
||||
{item.in_cart.price === '0'
|
||||
? 'Liên hệ'
|
||||
: `${formatCurrency(item.in_cart.total_price)} đ`}
|
||||
</b>
|
||||
@@ -158,11 +164,13 @@ const HeaderMid: React.FC = () => {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="cart-ttip-price flex items-center justify-end gap-2">
|
||||
<p>Tổng tiền hàng</p>
|
||||
<p className="font-medium">({cartQuantity} sản phẩm)</p>
|
||||
<p className="font-bold">{formatCurrency(cartTotal)}đ</p>
|
||||
<p className="font-bold">{formatCurrency(cartTotal)} đ</p>
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href="/cart"
|
||||
className="cart-ttip-price-button flex items-center justify-center"
|
||||
@@ -172,18 +180,21 @@ const HeaderMid: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href="/taikhoan"
|
||||
className="user-header item-tab-header flex flex-col items-center gap-4"
|
||||
<button
|
||||
type="button"
|
||||
className="user-header item-tab-header flex flex-col items-center gap-4 opacity-70"
|
||||
aria-disabled="true"
|
||||
title="Tính năng tài khoản đang được cập nhật"
|
||||
>
|
||||
<p className="icon-item-tab flex items-center justify-center">
|
||||
<i className="sprite sprite-account-header"></i>
|
||||
</p>
|
||||
<span className="font-medium">Tài khoản</span>
|
||||
</Link>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BoxShowroom />
|
||||
<BoxHotLine />
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Autoplay, Navigation, Pagination } from 'swiper/modules';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
|
||||
// Định nghĩa kiểu dữ liệu cho mỗi Banner
|
||||
interface BannerItem {
|
||||
id: number;
|
||||
link: string;
|
||||
@@ -13,7 +12,6 @@ interface BannerItem {
|
||||
altText: string;
|
||||
}
|
||||
|
||||
// Dữ liệu mẫu (Bạn có thể fetch từ API)
|
||||
const BANNER_DATA: BannerItem[] = [
|
||||
{
|
||||
id: 429,
|
||||
|
||||
Reference in New Issue
Block a user