220 lines
5.8 KiB
HTML
220 lines
5.8 KiB
HTML
{{ define "main" }}
|
|
{{ .Content }}
|
|
|
|
<style>
|
|
.featured-cases-section {
|
|
margin: 4rem 0;
|
|
padding: 3rem 0;
|
|
background: rgba(244, 208, 63, 0.05);
|
|
border-radius: 24px;
|
|
}
|
|
|
|
.featured-cases-section h2 {
|
|
text-align: center;
|
|
margin-bottom: 1rem;
|
|
color: var(--text-primary);
|
|
font-size: 2.5rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.featured-cases-section p {
|
|
text-align: center;
|
|
margin-bottom: 2.5rem;
|
|
color: var(--text-secondary);
|
|
font-size: 1.125rem;
|
|
}
|
|
|
|
.featured-cases-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 2rem;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 0 2rem;
|
|
}
|
|
|
|
.featured-case-card {
|
|
background: var(--card-background);
|
|
border-radius: 16px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 12px var(--shadow);
|
|
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
position: relative;
|
|
border: 1px solid var(--border);
|
|
}
|
|
|
|
.featured-case-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.featured-card-banner {
|
|
position: relative;
|
|
margin-bottom: 1rem;
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
aspect-ratio: 16/9;
|
|
}
|
|
|
|
.featured-case-banner {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
}
|
|
|
|
.featured-case-logo {
|
|
width: 100%;
|
|
height: 200px;
|
|
object-fit: contain;
|
|
display: block;
|
|
padding: 1rem;
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.featured-case-logo-overlay {
|
|
position: absolute;
|
|
bottom: 16px;
|
|
right: 16px;
|
|
width: 56px;
|
|
height: 56px;
|
|
object-fit: contain;
|
|
background: rgba(255, 255, 255, 0.9);
|
|
border-radius: 10px;
|
|
padding: 6px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.featured-case-content {
|
|
padding: 0 1.5rem 1.5rem 1.5rem;
|
|
}
|
|
|
|
.featured-case-title {
|
|
display: inline-block;
|
|
padding: 8px 16px;
|
|
background: var(--e2c-yellow);
|
|
color: var(--text-primary);
|
|
text-decoration: none;
|
|
border-radius: 12px;
|
|
margin: 8px 0;
|
|
font-weight: 600;
|
|
font-size: 1.1rem;
|
|
transition: all 0.2s ease;
|
|
border: 2px solid var(--e2c-yellow);
|
|
}
|
|
|
|
.featured-case-title:hover {
|
|
background: var(--e2c-dark-yellow);
|
|
border-color: var(--e2c-dark-yellow);
|
|
color: var(--text-primary);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.featured-case-description {
|
|
color: var(--text-secondary);
|
|
font-size: 0.95rem;
|
|
line-height: 1.5;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
.featured-case-link {
|
|
display: block;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
}
|
|
|
|
.featured-banner-link {
|
|
display: block;
|
|
text-decoration: none;
|
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
}
|
|
|
|
.featured-banner-link:hover {
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.featured-cases-grid {
|
|
grid-template-columns: 1fr;
|
|
gap: 1.5rem;
|
|
padding: 0 1rem;
|
|
}
|
|
|
|
.featured-cases-section {
|
|
margin: 2rem 0;
|
|
padding: 2rem 0;
|
|
}
|
|
|
|
.featured-cases-section h2 {
|
|
font-size: 2rem;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Case studies data - this will be populated by Hugo
|
|
const caseStudies = [
|
|
{{ range where .Site.Pages "Section" "case-studies" }}
|
|
{{ if and .Params.image .Title (ne .Title "Case Studies") }}
|
|
{
|
|
title: "{{ .Title | replaceRE `"` `\"` }}",
|
|
description: "{{ if .Description }}{{ .Description | replaceRE `"` `\"` }}{{ else }}{{ .Summary | plainify | truncate 150 | replaceRE `"` `\"` }}{{ end }}",
|
|
url: "{{ .RelPermalink }}",
|
|
image: "{{ .Params.image }}",
|
|
banner: {{ if .Params.banner }}"{{ .Params.banner }}"{{ else }}null{{ end }}
|
|
},
|
|
{{ end }}
|
|
{{ end }}
|
|
].filter(study => study.title); // Remove any empty entries
|
|
|
|
// Function to shuffle array and get random selection
|
|
function getRandomCases(cases, count = 3) {
|
|
const shuffled = [...cases].sort(() => 0.5 - Math.random());
|
|
return shuffled.slice(0, count);
|
|
}
|
|
|
|
// Function to create case card HTML
|
|
function createCaseCard(caseStudy) {
|
|
const hasImage = caseStudy.image && caseStudy.image !== 'null' && caseStudy.image !== null;
|
|
const hasBanner = caseStudy.banner && caseStudy.banner !== 'null' && caseStudy.banner !== null;
|
|
|
|
let imageHTML = '';
|
|
if (hasBanner) {
|
|
imageHTML = `
|
|
<a href="${caseStudy.url}" class="featured-banner-link">
|
|
<div class="featured-card-banner">
|
|
<img src="${caseStudy.banner}" alt="${caseStudy.title} banner" class="featured-case-banner" />
|
|
${hasImage ? `<img src="${caseStudy.image}" alt="${caseStudy.title} logo" class="featured-case-logo-overlay" />` : ''}
|
|
</div>
|
|
</a>
|
|
`;
|
|
} else if (hasImage) {
|
|
imageHTML = `
|
|
<a href="${caseStudy.url}" class="featured-banner-link">
|
|
<img src="${caseStudy.image}" alt="${caseStudy.title} logo" class="featured-case-logo" />
|
|
</a>
|
|
`;
|
|
}
|
|
|
|
return `
|
|
<div class="featured-case-card">
|
|
${imageHTML}
|
|
<div class="featured-case-content">
|
|
<h3><a href="${caseStudy.url}" class="featured-case-title">${caseStudy.title}</a></h3>
|
|
<p class="featured-case-description">${caseStudy.description}</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
// Populate featured cases
|
|
const featuredCasesGrid = document.getElementById('featuredCasesGrid');
|
|
if (featuredCasesGrid && caseStudies.length > 0) {
|
|
const randomCases = getRandomCases(caseStudies, 3);
|
|
featuredCasesGrid.innerHTML = randomCases.map(createCaseCard).join('');
|
|
}
|
|
});
|
|
</script>
|
|
{{ end }} |