@@ -26,6 +26,10 @@ interface ModalProps {
|
||||
data: CaseStudyData | null;
|
||||
}
|
||||
|
||||
function nodeToSlug(title: string): string {
|
||||
return title.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, '');
|
||||
}
|
||||
|
||||
const renderMarkdown = (text: string) => {
|
||||
if (!text) return null;
|
||||
const lines = text.split('\n');
|
||||
@@ -195,7 +199,8 @@ export default function CaseStudyModal({ isOpen, onClose, data }: ModalProps) {
|
||||
|
||||
const isEvent = data.nodeType === "event";
|
||||
const isHQ = data.nodeType === "hq";
|
||||
const coverImage = data.mediaFileName ? `/cases/${data.mediaFileName}` : null;
|
||||
const nodeSlug = nodeToSlug(data.title);
|
||||
const coverImage = data.mediaFileName ? `/cases/${nodeSlug}/${data.mediaFileName}` : null;
|
||||
|
||||
let formattedDate = null;
|
||||
let isUpcoming = false;
|
||||
@@ -321,7 +326,7 @@ export default function CaseStudyModal({ isOpen, onClose, data }: ModalProps) {
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{gallery.map((imgSrc, idx) => (
|
||||
<div key={idx} className={`relative rounded-2xl overflow-hidden bg-[#1D1D1F] border border-black/10 dark:border-white/10 ${idx === 0 && gallery.length % 2 !== 0 ? 'sm:col-span-2 h-64 md:h-80' : 'h-48 md:h-64'}`}>
|
||||
<Image src={`/cases/${imgSrc}`} alt={`Gallery image ${idx + 1}`} fill className="object-cover hover:scale-105 transition-transform duration-700" />
|
||||
<Image src={`/cases/${nodeSlug}/${imgSrc}`} alt={`Gallery image ${idx + 1}`} fill className="object-cover hover:scale-105 transition-transform duration-700" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user