/**
* Atlantic Motors Produktkategorier
*
* Dette er en WooCommerce-kompatibel versjon for visning av bilpleieprodukt-kategorier.
* Koden er designet for å erstattes med HTML og CSS uten avhengigheter til React.
*/
// HTML-struktur som kan legges inn direkte i WooCommerce-sider
const atlanticCategoriesHTML = `
`;
// CSS for kategorivisningen
const atlanticCategoriesCSS = `
/* Hovedstil */
.am-product-categories {
font-family: 'Helvetica Neue', Arial, sans-serif;
max-width: 1400px;
margin: 0 auto;
padding: 0 20px;
color: #333;
}
/* Hovedbanner */
.am-main-banner {
background-color: #1c1c1c;
color: white;
padding: 50px 30px;
text-align: center;
margin-bottom: 40px;
border-radius: 8px;
background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('ERSTATT-MED-BANNERBILDE-URL');
background-size: cover;
background-position: center;
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.am-main-banner h1 {
font-size: 42px;
margin: 0 0 15px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
}
.am-main-banner p {
font-size: 20px;
margin: 0;
opacity: 0.9;
max-width: 800px;
margin: 0 auto;
}
/* Kategori-navigasjon */
.am-category-navigation {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 30px;
background: #fff;
padding: 10px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.am-category-nav-btn {
padding: 12px 20px;
background: transparent;
border: none;
border-radius: 30px;
font-size: 15px;
font-weight: 600;
color: #555;
cursor: pointer;
transition: all 0.3s ease;
}
.am-category-nav-btn:hover {
color: #FF5E0E;
background: #f8f8f8;
}
.am-category-nav-btn.active {
background: #FF5E0E;
color: white;
box-shadow: 0 3px 10px rgba(255,94,14,0.2);
}
/* Filtreringssystem */
.am-filter-section {
display: flex;
flex-wrap: wrap;
gap: 15px;
margin-bottom: 40px;
background: #f5f5f5;
padding: 20px;
border-radius: 8px;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.am-search-box {
flex: 1;
min-width: 250px;
position: relative;
}
.am-search-box input {
width: 100%;
padding: 14px 20px;
border: 1px solid #ddd;
border-radius: 50px;
font-size: 16px;
background-color: white;
transition: all 0.3s ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.am-search-box input:focus {
outline: none;
border-color: #FF5E0E;
box-shadow: 0 2px 15px rgba(255,94,14,0.15);
}
.am-sort-options {
display: flex;
align-items: center;
gap: 10px;
}
.am-sort-options label {
font-weight: 500;
}
.am-sort-options select {
padding: 12px 20px;
border: 1px solid #ddd;
border-radius: 50px;
background-color: white;
font-size: 15px;
cursor: pointer;
transition: all 0.3s ease;
}
.am-sort-options select:focus {
outline: none;
border-color: #FF5E0E;
}
/* Kategorivisning */
.am-category-section {
margin-bottom: 50px;
}
.am-category-section.hidden {
display: none;
}
.am-section-title {
font-size: 28px;
margin-bottom: 25px;
position: relative;
padding-bottom: 10px;
font-weight: 600;
}
.am-section-title:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 60px;
height: 3px;
background-color: #FF5E0E;
border-radius: 3px;
}
/* Kategorigrid */
.am-categories-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 25px;
}
.am-category-card {
background: white;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0,0,0,0.08);
transition: all 0.3s ease;
position: relative;
text-decoration: none;
color: inherit;
display: flex;
flex-direction: column;
border: 1px solid #eee;
}
.am-category-card:hover {
transform: translateY(-8px);
box-shadow: 0 12px 30px rgba(0,0,0,0.12);
border-color: #ddd;
}
.am-category-image {
height: 220px;
overflow: hidden;
position: relative;
}
.am-category-image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s ease;
}
.am-category-card:hover .am-category-image img {
transform: scale(1.08);
}
.am-category-badge {
position: absolute;
top: 15px;
right: 15px;
background-color: #FF5E0E;
color: white;
padding: 6px 12px;
border-radius: 30px;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
box-shadow: 0 2px 10px rgba(255,94,14,0.3);
z-index: 1;
}
.am-category-content {
padding: 25px;
display: flex;
flex-direction: column;
flex-grow: 1;
position: relative;
}
.am-category-content h3 {
margin: 0 0 12px;
font-size: 20px;
font-weight: 600;
color: #222;
}
.am-category-content p {
margin: 0 0 20px;
color: #666;
font-size: 14px;
line-height: 1.5;
flex-grow: 1;
}
.am-category-count {
font-size: 13px;
color: #888;
background: #f7f7f7;
padding: 5px 10px;
border-radius: 20px;
display: inline-block;
font-weight: 500;
}
.am-view-more {
margin-top: 15px;
color: #FF5E0E;
font-weight: 600;
font-size: 14px;
display: inline-flex;
align-items: center;
transition: all 0.3s ease;
}
.am-icon-arrow {
margin-left: 5px;
transition: transform 0.3s ease;
}
.am-category-card:hover .am-view-more {
color: #e04500;
}
.am-category-card:hover .am-icon-arrow {
transform: translateX(3px);
}
/* Featured kategori kort */
.featured-card {
border: 2px solid #FF5E0E;
}
/* Ingen resultater */
.am-no-results {
text-align: center;
padding: 50px 20px;
background: #f9f9f9;
border-radius: 10px;
margin: 40px 0;
border: 1px dashed #ddd;
}
.am-no-results p {
margin: 0 0 20px;
font-size: 18px;
color: #666;
}
.am-reset-btn {
background-color: #FF5E0E;
color: white;
border: none;
padding: 12px 25px;
border-radius: 30px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 3px 10px rgba(255,94,14,0.2);
}
.am-reset-btn:hover {
background-color: #e04500;
box-shadow: 0 5px 15px rgba(255,94,14,0.3);
}
/* Kundeservice seksjon */
.am-customer-service {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
gap: 20px;
padding: 40px;
margin: 50px 0;
background-color: #1c1c1c;
border-radius: 10px;
color: white;
text-align: center;
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}
.am-service-item {
flex: 1;
min-width: 220px;
padding: 20px;
transition: transform 0.3s ease;
}
.am-service-item:hover {
transform: translateY(-5px);
}
.am-service-icon {
margin-bottom: 15px;
display: flex;
justify-content: center;
}
.am-service-item h3 {
font-size: 20px;
margin: 0 0 10px;
font-weight: 600;
}
.am-service-item p {
font-size: 14px;
margin: 0;
opacity: 0.8;
}
/* Responsivt design */
@media (max-width: 991px) {
.am-main-banner h1 {
font-size: 36px;
}
.am-main-banner p {
font-size: 18px;
}
.am-categories-grid {
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.am-category-section {
margin-bottom: 40px;
}
}
@media (max-width: 768px) {
.am-category-navigation {
overflow-x: auto;
justify-content: flex-start;
padding: 10px;
}
.am-category-nav-btn {
white-space: nowrap;
padding: 10px 15px;
font-size: 14px;
}
.am-filter-section {
flex-direction: column;
align-items: stretch;
}
.am-categories-grid {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.am-main-banner {
padding: 40px 20px;
}
.am-main-banner h1 {
font-size: 30px;
}
.am-main-banner p {
font-size: 16px;
}
.am-customer-service {
padding: 30px 20px;
}
.am-section-title {
font-size: 24px;
}
}
@media (max-width: 480px) {
.am-categories-grid {
grid-template-columns: 1fr;
}
.am-category-image {
height: 200px;
}
.am-main-banner h1 {
font-size: 26px;
}
.am-section-title {
font-size: 22px;
}
.am-category-content {
padding: 20px;
}
.am-customer-service {
gap: 15px;
}
}
`;
// Javascript for kategorivisning og funksjonalitet
const atlanticCategoriesJS = `
document.addEventListener('DOMContentLoaded', function() {
// Kategoribytte
const categoryButtons = document.querySelectorAll('.am-category-nav-btn');
const allSections = document.querySelectorAll('.am-category-section');
// Hente alle kategorikorter for søk og filtrering
const allCards = document.querySelectorAll('.am-category-card');
// Søke- og filtreringselementer
const searchInput = document.getElementById('productSearch');
const sortSelect = document.getElementById('sortCategories');
const noResults = document.getElementById('noResults');
const resetBtn = document.getElementById('resetSearchBtn');
// Startvisning er Bilvask
let currentCategory = 'bilvask';
// Legge til klikkhendelser for kategoriknapper
categoryButtons.forEach(button => {
button.addEventListener('click', function() {
// Fjerne active-klassen fra alle knapper
categoryButtons.forEach(btn => btn.classList.remove('active'));
// Legge til active-klasse på klikket knapp
this.classList.add('active');
// Hente kategori-ID
const category = this.getAttribute('data-category');
currentCategory = category;
// Skjule alle seksjoner
allSections.forEach(section => section.classList.add('hidden'));
// Vise valgt seksjon
document.getElementById(category + '-section').classList.remove('hidden');
// Nullstille søk og filtrering
searchInput.value = '';
sortSelect.value = 'all';
noResults.style.display = 'none';
// Vise alle kort i den valgte kategorien
resetCardVisibility();
});
});
// Søkefunksjonalitet
searchInput.addEventListener('keyup', filterCards);
// Sorteringsfunksjonalitet
sortSelect.addEventListener('change', sortCards);
// Tilbakestill søkefunksjonalitet
resetBtn.addEventListener('click', function() {
searchInput.value = '';
sortSelect.value = 'all';
resetCardVisibility();
noResults.style.display = 'none';
});
// Funksjon for å filtrere kort basert på søk
function filterCards() {
const searchTerm = searchInput.value.toLowerCase();
let resultsFound = false;
// Finn hvilken kategori som er aktiv nå
const currentSection = document.getElementById(currentCategory + '-section');
const currentCards = currentSection.querySelectorAll('.am-category-card');
// Filtrer kort basert på søkeord
currentCards.forEach(card => {
const title = card.querySelector('h3').textContent.toLowerCase();
const description = card.querySelector('p').textContent.toLowerCase();
if (title.includes(searchTerm) || description.includes(searchTerm)) {
card.style.display = 'flex';
resultsFound = true;
} else {
card.style.display = 'none';
}
});
// Vis eller skjul "ingen resultater" meldingen
noResults.style.display = resultsFound ? 'none' : 'block';
}
// Funksjon for å sortere kort
function sortCards() {
const sortOption = sortSelect.value;
const currentSection = document.getElementById(currentCategory + '-section');
const cardsContainer = currentSection.querySelector('.am-categories-grid');
// Få tak i alle kort i nåværende kategori
const cards = Array.from(cardsContainer.querySelectorAll('.am-category-card'));
if (sortOption === 'all') {
// Reset til original rekkefølge
resetCardVisibility();
} else if (sortOption === 'popular') {
// Sorter basert på antall produkter (popularitet)
cards.sort((a, b) => {
const aCount = parseInt(a.getAttribute('data-items')) || 0;
const bCount = parseInt(b.getAttribute('data-items')) || 0;
return bCount - aCount;
});
// Fjern og legg til kort i riktig rekkefølge
cards.forEach(card => cardsContainer.appendChild(card));
} else if (sortOption === 'az') {
// Sorter alfabetisk
cards.sort((a, b) => {
const aTitle = a.querySelector('h3').textContent;
const bTitle = b.querySelector('h3').textContent;
return aTitle.localeCompare(bTitle, 'nb');
});
// Fjern og legg til kort i riktig rekkefølge
cards.forEach(card => cardsContainer.appendChild(card));
}
}
// Funksjon for å tilbakestille kortvisning
function resetCardVisibility() {
// Vis alle kort i gjeldende kategori
const currentSection = document.getElementById(currentCategory + '-section');
const currentCards = currentSection.querySelectorAll('.am-category-card');
currentCards.forEach(card => {
card.style.display = 'flex';
});
}
// Håndtere bildefeil
document.querySelectorAll('.am-category-image img').forEach(img => {
img.onerror = function() {
this.src = 'https://via.placeholder.com/600x400?text=Atlantic+Motors';
};
});
});
`;
// Fullstendig HTML-kode med CSS og JavaScript
const fullHTMLCode = `
${atlanticCategoriesHTML}
`;
Bilpleieprodukter
Kvalitetsprodukter for optimal pleie av din bil
Bilvask
Populær
Bilvask
Komplett utvalg av vaskeprodukter for alle biltyper
12 produkter Se produkter →Avfetting
Effektive produkter for fjerning av vanskelig smuss og fett
Kommer snart Se produkter →Bilshampo
Skånsom og effektiv shampo for alle typer bilvask
2 produkter Se produkter →Dekk og felgrens
Spesialiserte produkter for rengjøring og vedlikehold av dekk og felger
4 produkter Se produkter →Interiør
Polering og Lakk
Utstyr og Tilbehør
Voks og Forsegling
Ingen kategorier funnet som matcher ditt søk. Prøv et annet søkeord.
Service
Pålitelig og effektivt
Levering
Rask og trygg levering
Garanti
Vi står bak det vi selger
