bitlo's picture
1 Добавь футер, в футере 3 пункта Минск , Москва , Алматы
4b3e4a2 verified
class CustomFooter extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
footer {
background-color: #f8fafc;
padding: 2rem 1rem;
border-top: 1px solid #e5e7eb;
}
.container {
max-width: 1200px;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
}
.locations {
display: flex;
gap: 2rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
justify-content: center;
}
.location-btn {
background: white;
border: 1px solid #e5e7eb;
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.3s ease;
}
.location-btn:hover {
background: #f3f4f6;
border-color: #d1d5db;
}
.address {
max-width: 600px;
text-align: center;
padding: 1rem;
background: white;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
display: none;
}
.address.active {
display: block;
}
.copyright {
margin-top: 1.5rem;
color: #6b7280;
font-size: 0.875rem;
}
</style>
<footer>
<div class="container">
<div class="locations">
<button class="location-btn" data-city="minsk">Минск</button>
<button class="location-btn" data-city="moscow">Москва</button>
<button class="location-btn" data-city="almaty">Алматы</button>
</div>
<div class="address" id="minsk-address">
Адрес: ул. Толстого 10, Минск, Минская область, Беларусь
</div>
<div class="address" id="moscow-address">
Адрес: Романов пер., 4 2, Москва, Россия, 125009
</div>
<div class="address" id="almaty-address">
Адрес: улица Желтоксан 115, Алматы 050000, Казахстан
</div>
<div class="copyright">
© ${new Date().getFullYear()} TOPTERA. Все права защищены.
</div>
</div>
</footer>
`;
// Add click handlers for location buttons
const buttons = this.shadowRoot.querySelectorAll('.location-btn');
buttons.forEach(button => {
button.addEventListener('click', () => {
const city = button.getAttribute('data-city');
const addresses = this.shadowRoot.querySelectorAll('.address');
// Hide all addresses
addresses.forEach(addr => addr.classList.remove('active'));
// Show selected address
this.shadowRoot.getElementById(`${city}-address`).classList.add('active');
});
});
}
}
customElements.define('custom-footer', CustomFooter);