Files
static-front/components/ShowcaseSection.tsx
T
Hamed 4cd34106b0
Build & Deploy (develop) / build-and-deploy (push) Successful in 2m23s
refactor: migrate project to TypeScript and translate comments to English
2026-09-14 13:27:17 +02:00

29 lines
831 B
TypeScript

'use client';
import {useEffect, useState} from 'react';
import HorizontalShowcase from './HorizontalShowcase';
import MobileShowcase from './MobileShowcase';
const MOBILE_BREAKPOINT = 768;
export default function ShowcaseSection() {
const [isMobile, setIsMobile] = useState<boolean | null>(null);
useEffect(() => {
const mediaQuery = window.matchMedia(
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
);
const handleChange = (event: MediaQueryListEvent) => setIsMobile(event.matches);
setIsMobile(mediaQuery.matches);
mediaQuery.addEventListener('change', handleChange);
return () => mediaQuery.removeEventListener('change', handleChange);
}, []);
if (isMobile === null) return null;
return isMobile ? <MobileShowcase/> : <HorizontalShowcase/>;
}