Part 1: Source code - Astro project structure and components
This commit is contained in:
118
src/components/common/Footer.astro
Normal file
118
src/components/common/Footer.astro
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
const companyInfo = {
|
||||
name: "ดีล พลัส เทค จำกัด",
|
||||
phone: "090-555-1415",
|
||||
email: "dealplustech@gmail.com",
|
||||
line: "@JPPSELECTION",
|
||||
address: "9/70 ซอยนครลุง 17 แขวงบางไผ่ เขตบางแค กรุงเทพมหานคร 10160",
|
||||
hours: "จันทร์-ศุกร์ 08:00-18:00 เสาร์ 08:00-17:00"
|
||||
};
|
||||
|
||||
const productLinks = [
|
||||
{ title: "ท่อพีพีอาร์", href: "/ท่อ-ppr-thai-ppr" },
|
||||
{ title: "ท่อ HDPE", href: "/ท่อ-hdpe" },
|
||||
{ title: "ท่อ UPVC", href: "/ท่อ-upvc" },
|
||||
{ title: "เครื่องเชื่อมท่อ", href: "/เครื่องเชื่อม-hdpe" },
|
||||
{ title: "วาล์ว", href: "/วาล์ว-valve" },
|
||||
{ title: "ปั๊มน้ำ", href: "/water-pump" },
|
||||
];
|
||||
---
|
||||
|
||||
<footer class="bg-primary-700 text-white">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 lg:py-16">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 lg:gap-12">
|
||||
<!-- Company Info -->
|
||||
<div class="lg:col-span-1">
|
||||
<img src="/images/logo.png" alt="ดีล พลัส เทค" class="h-10 w-auto mb-4" />
|
||||
<div class="space-y-3 text-sm text-primary-100">
|
||||
<p class="flex items-start gap-2">
|
||||
<svg class="w-5 h-5 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
<span>{companyInfo.address}</span>
|
||||
</p>
|
||||
<p class="flex items-center gap-2">
|
||||
<svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
||||
</svg>
|
||||
<a href={`tel:${companyInfo.phone}`} class="hover:text-accent-400">{companyInfo.phone}</a>
|
||||
</p>
|
||||
<p class="flex items-center gap-2">
|
||||
<svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<a href={`mailto:${companyInfo.email}`} class="hover:text-accent-400">{companyInfo.email}</a>
|
||||
</p>
|
||||
<p class="flex items-center gap-2">
|
||||
<svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
|
||||
</svg>
|
||||
<span>LINE: {companyInfo.line}</span>
|
||||
</p>
|
||||
<p class="text-primary-200 text-xs">{companyInfo.hours}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick Links -->
|
||||
<div>
|
||||
<h3 class="font-semibold text-lg mb-4">ลิงก์ด่วน</h3>
|
||||
<ul class="space-y-2 text-sm text-primary-100">
|
||||
<li><a href="/" class="hover:text-accent-400 transition-colors">หน้าแรก</a></li>
|
||||
<li><a href="/about-us" class="hover:text-accent-400 transition-colors">เกี่ยวกับเรา</a></li>
|
||||
<li><a href="/all-products" class="hover:text-accent-400 transition-colors">สินค้าทั้งหมด</a></li>
|
||||
<li><a href="/portfolio" class="hover:text-accent-400 transition-colors">ผลงาน</a></li>
|
||||
<li><a href="/contact-us" class="hover:text-accent-400 transition-colors">ติดต่อเรา</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Products -->
|
||||
<div>
|
||||
<h3 class="font-semibold text-lg mb-4">สินค้ายอดนิยม</h3>
|
||||
<ul class="space-y-2 text-sm text-primary-100">
|
||||
{productLinks.map(link => (
|
||||
<li><a href={link.href} class="hover:text-accent-400 transition-colors">{link.title}</a></li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Contact CTA -->
|
||||
<div>
|
||||
<h3 class="font-semibold text-lg mb-4">ติดต่อเรา</h3>
|
||||
<div class="space-y-3">
|
||||
<a
|
||||
href={`tel:${companyInfo.phone}`}
|
||||
class="flex items-center justify-center gap-2 w-full bg-primary-600 hover:bg-primary-500 text-white py-3 px-4 rounded-lg font-medium transition-colors"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
||||
</svg>
|
||||
โทรเลย
|
||||
</a>
|
||||
<a
|
||||
href="https://line.me/ti/p/~JPPSELECTION"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="flex items-center justify-center gap-2 w-full bg-accent-500 hover:bg-accent-600 text-white py-3 px-4 rounded-lg font-medium transition-colors"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.344.282-.629.627-.629h2.386c.349 0 .63.285.63.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.629.63-.629.345 0 .63.284.63.629v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.629.627-.629.349 0 .631.284.631.629v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.629.63-.629.348 0 .63.284.63.629v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 24 10.314"/>
|
||||
</svg>
|
||||
แอดไลน์
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bottom bar -->
|
||||
<div class="mt-12 pt-8 border-t border-primary-600">
|
||||
<div class="flex flex-col sm:flex-row justify-between items-center gap-4 text-sm text-primary-200">
|
||||
<p>© {new Date().getFullYear()} {companyInfo.name}. สงวนลิขสิทธิ์.</p>
|
||||
<div class="flex gap-6">
|
||||
<a href="/privacy-policy" class="hover:text-white transition-colors">นโยบายความเป็นส่วนตัว</a>
|
||||
<a href="/terms-and-conditions" class="hover:text-white transition-colors">ข้อกำหนดการใช้งาน</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
132
src/components/common/Header.astro
Normal file
132
src/components/common/Header.astro
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
const navItems = [
|
||||
{ label: "หน้าแรก", href: "/" },
|
||||
{ label: "เกี่ยวกับเรา", href: "/about-us" },
|
||||
];
|
||||
|
||||
const productCategories = [
|
||||
{
|
||||
title: "ท่อพีพีอาร์",
|
||||
items: [
|
||||
{ label: "ไทยพีพีอาร์", href: "/ท่อ-ppr-thai-ppr" },
|
||||
{ label: "ท่อ PPR ตราช้าง", href: "/ท่อ-ppr-scg" },
|
||||
{ label: "ท่อ PP-R Poloplast", href: "/pp-r-poloplast" },
|
||||
{ label: "ท่อ HDPE", href: "/ท่อ-hdpe" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "ท่อ UPVC/Specialty",
|
||||
items: [
|
||||
{ label: "ท่อ UPVC", href: "/ท่อ-upvc" },
|
||||
{ label: "ท่อ Syler", href: "/ท่อ-syler" },
|
||||
{ label: "ท่อ PVC และข้อต่อ", href: "/ท่อ-และข้อต่อ-pvc" },
|
||||
{ label: "ท่อ XYLENT", href: "/ท่อ-xy-lent" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "เครื่องเชื่อมท่อ",
|
||||
items: [
|
||||
{ label: "เครื่องเชื่อม HDPE", href: "/เครื่องเชื่อม-hdpe" },
|
||||
{ label: "เครื่องเชื่อม PPR", href: "/เครื่องเชื่อม-ppr" },
|
||||
{ label: "Pipe Coupling", href: "/pipe-coupling" },
|
||||
{ label: "เม็กกรู๊ฟ คับปลิ้ง", href: "/เม็กกรู๊ฟ-คับปลิ้ง" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "วาล์ว",
|
||||
items: [
|
||||
{ label: "วาล์ว Valve", href: "/วาล์ว-valve" },
|
||||
{ label: "DURGO วาล์วเติมอากาศ", href: "/durgo-avvs" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "ปั๊มและระบบน้ำ",
|
||||
items: [
|
||||
{ label: "ปั๊มน้ำ Water Pump", href: "/water-pump" },
|
||||
{ label: "ระบบกรองน้ำ", href: "/water-treatment" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "อุปกรณ์ปรับอากาศ",
|
||||
items: [
|
||||
{ label: "อุปกรณ์ปรับอากาศ", href: "/อุปกรณ์ปรับอากาศ" },
|
||||
{ label: "กริลแอร์", href: "/grilles" },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "ฉนวนและรั้ว",
|
||||
items: [
|
||||
{ label: "ฉนวนหุ้มท่อ", href: "/ฉนวนหุ้มท่อ" },
|
||||
{ label: "เทอร์โมเบรค Thermobreak", href: "/เทอร์โมเบรค-thermobreak" },
|
||||
{ label: "Realflex", href: "/realflex" },
|
||||
{ label: "อุปกรณ์ดับเพลิง", href: "/อุปกรณ์ดับเพลิง" },
|
||||
{ label: "รั้วเทวดา", href: "/รั้วเทวดา" },
|
||||
{ label: "ระบบรั้วไวน์แมน", href: "/ระบบรั้วไวน์แมน" },
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
const currentPath = Astro.url.pathname;
|
||||
---
|
||||
|
||||
<header class="sticky top-0 z-50 bg-white/95 backdrop-blur-sm border-b border-neutral-200">
|
||||
<nav class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex items-center justify-between h-16 lg:h-20">
|
||||
<!-- Logo -->
|
||||
<a href="/" class="flex items-center gap-2">
|
||||
<div class="w-10 h-10 bg-primary-500 rounded-lg flex items-center justify-center">
|
||||
<span class="text-white font-bold text-lg">ดีล</span>
|
||||
</div>
|
||||
<span class="font-semibold text-xl text-primary-700 hidden sm:block">ดีล พลัส เทค</span>
|
||||
</a>
|
||||
|
||||
<!-- Desktop Nav -->
|
||||
<div class="hidden lg:flex items-center gap-8">
|
||||
<a href="/" class={`text-sm font-medium transition-colors ${currentPath === '/' ? 'text-primary-600' : 'text-neutral-600 hover:text-primary-600'}`}>
|
||||
หน้าแรก
|
||||
</a>
|
||||
<a href="/about-us" class={`text-sm font-medium transition-colors ${currentPath === '/about-us' ? 'text-primary-600' : 'text-neutral-600 hover:text-primary-600'}`}>
|
||||
เกี่ยวกับเรา
|
||||
</a>
|
||||
<a href="/all-products" class={`text-sm font-medium transition-colors ${currentPath === '/all-products' ? 'text-primary-600' : 'text-neutral-600 hover:text-primary-600'}`}>
|
||||
สินค้าทั้งหมด
|
||||
</a>
|
||||
<a href="/contact-us" class={`text-sm font-medium transition-colors ${currentPath === '/contact-us' ? 'text-primary-600' : 'text-neutral-600 hover:text-primary-600'}`}>
|
||||
ติดต่อเรา
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Mobile menu button -->
|
||||
<button
|
||||
type="button"
|
||||
class="lg:hidden p-2 rounded-lg text-neutral-600 hover:bg-neutral-100"
|
||||
aria-label="เปิดเมนู"
|
||||
data-mobile-menu-toggle
|
||||
>
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Mobile menu -->
|
||||
<div class="lg:hidden hidden" data-mobile-menu>
|
||||
<div class="py-4 space-y-2 border-t border-neutral-200">
|
||||
<a href="/" class="block px-4 py-2 text-neutral-700 hover:bg-neutral-100 rounded-lg">หน้าแรก</a>
|
||||
<a href="/about-us" class="block px-4 py-2 text-neutral-700 hover:bg-neutral-100 rounded-lg">เกี่ยวกับเรา</a>
|
||||
<a href="/all-products" class="block px-4 py-2 text-neutral-700 hover:bg-neutral-100 rounded-lg">สินค้าทั้งหมด</a>
|
||||
<a href="/portfolio" class="block px-4 py-2 text-neutral-700 hover:bg-neutral-100 rounded-lg">ผลงาน</a>
|
||||
<a href="/contact-us" class="block px-4 py-2 text-neutral-700 hover:bg-neutral-100 rounded-lg">ติดต่อเรา</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
const menuToggle = document.querySelector('[data-mobile-menu-toggle]');
|
||||
const mobileMenu = document.querySelector('[data-mobile-menu]');
|
||||
|
||||
menuToggle?.addEventListener('click', () => {
|
||||
mobileMenu?.classList.toggle('hidden');
|
||||
});
|
||||
</script>
|
||||
43
src/components/common/StickyBottomCTA.astro
Normal file
43
src/components/common/StickyBottomCTA.astro
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
interface Props {
|
||||
phone?: string;
|
||||
lineUrl?: string;
|
||||
}
|
||||
|
||||
const { phone = "0905551415", lineUrl = "https://line.me/ti/p/~JPPSELECTION" } = Astro.props;
|
||||
|
||||
// Format phone for display and tel link
|
||||
const phoneFormatted = phone.replace(/-/g, "");
|
||||
---
|
||||
|
||||
<!-- Sticky Bottom CTA - Mobile Only -->
|
||||
<div class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 p-4 z-50 md:hidden safe-area-pb">
|
||||
<div class="flex gap-3">
|
||||
<a
|
||||
href={`tel:${phoneFormatted}`}
|
||||
class="flex-1 flex items-center justify-center gap-2 bg-emerald-600 text-white py-3.5 rounded-lg font-semibold text-base shadow-lg active:bg-emerald-700 transition-colors"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
||||
</svg>
|
||||
โทรเลย
|
||||
</a>
|
||||
<a
|
||||
href={lineUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex-1 flex items-center justify-center gap-2 bg-[#06DC02] text-white py-3.5 rounded-lg font-semibold text-base shadow-lg active:opacity-90 transition-opacity"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.344.282-.629.627-.629h2.386c.349 0 .63.285.63.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.629.63-.629.345 0 .63.284.63.629v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.629.627-.629.349 0 .631.284.631.629v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.629.63-.629.348 0 .63.284.63.629v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 24 10.314z"/>
|
||||
</svg>
|
||||
แชทเลย
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.safe-area-pb {
|
||||
padding-bottom: env(safe-area-inset-bottom, 0.5rem);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user