CSNET's picture
ลองสร้าง html5 ที่ใช้ NDVI กับไร่จริงในประเทศไทยมาซัก 1 แปลงให้ดูให้เห็นภาพหน่อย
b263139 verified
Raw History Blame Contribute Delete
12.3 kB
class CustomFooter extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.footer {
background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
color: #f9fafb;
padding: 3rem 0 2rem;
border-top: 1px solid rgba(16, 185, 129, 0.2);
}
.footer-container {
max-width: 1280px;
margin: 0 auto;
padding: 0 1rem;
}
.footer-content {
display: grid;
grid-template-columns: repeat(1, 1fr);
gap: 2rem;
margin-bottom: 3rem;
}
@media (min-width: 768px) {
.footer-content {
grid-template-columns: repeat(4, 1fr);
}
}
.footer-section h3 {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 1.5rem;
color: #10b981;
}
.footer-links {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.footer-link {
color: #d1d5db;
text-decoration: none;
font-size: 0.875rem;
transition: color 0.2s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.footer-link:hover {
color: #10b981;
}
.footer-link i {
width: 1rem;
height: 1rem;
}
.footer-info {
color: #9ca3af;
font-size: 0.875rem;
line-height: 1.5;
}
.footer-social {
display: flex;
gap: 1rem;
margin-top: 1.5rem;
}
.social-link {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.5rem;
height: 2.5rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
color: #f9fafb;
transition: all 0.2s ease;
}
.social-link:hover {
background: #10b981;
transform: translateY(-2px);
}
.footer-bottom {
border-top: 1px solid rgba(255, 255, 255, 0.1);
padding-top: 2rem;
text-align: center;
}
.footer-bottom-content {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
@media (min-width: 640px) {
.footer-bottom-content {
flex-direction: row;
justify-content: space-between;
}
}
.copyright {
color: #9ca3af;
font-size: 0.875rem;
}
.footer-legal {
display: flex;
gap: 1.5rem;
}
.legal-link {
color: #9ca3af;
text-decoration: none;
font-size: 0.875rem;
transition: color 0.2s ease;
}
.legal-link:hover {
color: #10b981;
}
.back-to-top {
position: fixed;
bottom: 2rem;
right: 2rem;
width: 3rem;
height: 3rem;
background: #10b981;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
transition: all 0.3s ease;
opacity: 0;
transform: translateY(20px);
z-index: 100;
}
.back-to-top.visible {
opacity: 1;
transform: translateY(0);
}
.back-to-top:hover {
background: #059669;
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}
</style>
<footer class="footer">
<div class="footer-container">
<div class="footer-content">
<div class="footer-section">
<h3>ThaiRice NDVI</h3>
<p class="footer-info">
Advanced NDVI monitoring platform for Thai rice farmers.
Real-time vegetation health analysis and actionable insights.
</p>
<div class="footer-social">
<a href="#" class="social-link" aria-label="Facebook">
<i data-feather="facebook"></i>
</a>
<a href="#" class="social-link" aria-label="Twitter">
<i data-feather="twitter"></i>
</a>
<a href="#" class="social-link" aria-label="LinkedIn">
<i data-feather="linkedin"></i>
</a>
<a href="#" class="social-link" aria-label="GitHub">
<i data-feather="github"></i>
</a>
</div>
</div>
<div class="footer-section">
<h3>Platform</h3>
<div class="footer-links">
<a href="#ndvi-map" class="footer-link">
<i data-feather="map"></i>
NDVI Maps
</a>
<a href="#field-details" class="footer-link">
<i data-feather="bar-chart-2"></i>
Analytics
</a>
<a href="#recommendations" class="footer-link">
<i data-feather="clipboard"></i>
Recommendations
</a>
<a href="/fields" class="footer-link">
<i data-feather="grid"></i>
All Fields
</a>
</div>
</div>
<div class="footer-section">
<h3>Resources</h3>
<div class="footer-links">
<a href="/documentation" class="footer-link">
<i data-feather="book"></i>
Documentation
</a>
<a href="/api" class="footer-link">
<i data-feather="code"></i>
API Reference
</a>
<a href="/blog" class="footer-link">
<i data-feather="edit"></i>
Blog
</a>
<a href="/support" class="footer-link">
<i data-feather="help-circle"></i>
Support
</a>
</div>
</div>
<div class="footer-section">
<h3>Contact</h3>
<div class="footer-links">
<a href="mailto:info@thairice-ndvi.com" class="footer-link">
<i data-feather="mail"></i>
info@thairice-ndvi.com
</a>
<a href="tel:+6621234567" class="footer-link">
<i data-feather="phone"></i>
+66 2 123 4567
</a>
<div class="footer-link">
<i data-feather="map-pin"></i>
<span>Bangkok, Thailand</span>
</div>
</div>
</div>
</div>
<div class="footer-bottom">
<div class="footer-bottom-content">
<div class="copyright">
© 2023 ThaiRice NDVI Visualizer. All rights reserved.
</div>
<div class="footer-legal">
<a href="/privacy" class="legal-link">Privacy Policy</a>
<a href="/terms" class="legal-link">Terms of Service</a>
<a href="/cookies" class="legal-link">Cookie Policy</a>
</div>
</div>
</div>
</div>
<div class="back-to-top" id="backToTop">
<i data-feather="arrow-up"></i>
</div>
</footer>
`;
// Initialize back to top button
this.initializeBackToTop();
// Replace feather icons
setTimeout(() => {
if (window.feather) {
window.feather.replace();
}
}, 100);
}
initializeBackToTop() {
const backToTop = this.shadowRoot.getElementById('backToTop');
if (backToTop) {
// Show/hide button based on scroll position
window.addEventListener('scroll', () => {
if (window.pageYOffset > 300) {
backToTop.classList.add('visible');
} else {
backToTop.classList.remove('visible');
}
});
// Scroll to top when clicked
backToTop.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
}
}
customElements.define('custom-footer', CustomFooter);