From 747c579b15c54dc5dbc50482d3361761853e007a Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Wed, 19 Nov 2025 22:34:07 +0100 Subject: feat: Refactor layout and styles for StopList and related components; add ThemeColorManager for dynamic theme support --- src/frontend/app/components/StopGallery.tsx | 42 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src/frontend/app/components/StopGallery.tsx') diff --git a/src/frontend/app/components/StopGallery.tsx b/src/frontend/app/components/StopGallery.tsx index 18d0725..500ea20 100644 --- a/src/frontend/app/components/StopGallery.tsx +++ b/src/frontend/app/components/StopGallery.tsx @@ -1,7 +1,7 @@ -import React, { useRef, useState, useEffect } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { type Stop } from "../data/StopDataProvider"; -import StopGalleryItem from "./StopGalleryItem"; import "./StopGallery.css"; +import StopGalleryItem from "./StopGalleryItem"; interface StopGalleryProps { stops: Stop[]; @@ -19,7 +19,9 @@ const StopGallery: React.FC = ({ useEffect(() => { const element = scrollRef.current; - if (!element) return; + if (!element || stops.length === 0) { + return; + } const handleScroll = () => { const scrollLeft = element.scrollLeft; @@ -34,9 +36,11 @@ const StopGallery: React.FC = ({ if (stops.length === 0 && emptyMessage) { return ( -
-

{title}

-

{emptyMessage}

+
+

{title}

+
+

{emptyMessage}

+
); } @@ -46,29 +50,27 @@ const StopGallery: React.FC = ({ } return ( -
+
-

{title}

+

{title}

+ {stops.length}
-
+
{stops.map((stop) => ( ))}
- - {stops.length > 1 && ( -
- {stops.map((_, index) => ( -
- ))} -
- )} +
+ {stops.map((_, index) => ( + + ))} +
); }; -- cgit v1.3