diff --git a/attached_assets/image_1772312049653.png b/attached_assets/image_1772312049653.png new file mode 100644 index 0000000..4e16567 Binary files /dev/null and b/attached_assets/image_1772312049653.png differ diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index e4bd7e0..4aee36c 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -12,7 +12,35 @@ import { PhotoGalleryWidget } from "@/components/photo-gallery"; import { HoroscopeWidget } from "@/components/horoscope-widget"; import { RecipeWidget } from "@/components/recipe-widget"; import { NewsWidget } from "@/components/news-widget"; -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect, useCallback, useRef } from "react"; + +function SmartImage({ src, alt, className = "" }: { src: string; alt: string; className?: string }) { + const imgRef = useRef(null); + const [isPortrait, setIsPortrait] = useState(false); + + useEffect(() => { + const img = new Image(); + img.onload = () => { + if (img.naturalHeight > img.naturalWidth * 1.2) { + setIsPortrait(true); + } + }; + img.src = src; + }, [src]); + + if (isPortrait) { + return ( +
+ + {alt} +
+ ); + } + + return ( + {alt} + ); +} interface GalleryImage { folder: string; @@ -43,8 +71,8 @@ function HeroCard({ article }: { article: Article }) { return (
-
- {article.title} +
+ {isVideo && (
@@ -79,7 +107,7 @@ function GalleryHeroCard({ images }: { images: GalleryImage[] }) {
- {images[idx].fileName} +