diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-30 20:49:48 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-30 20:49:48 +0100 |
| commit | a68ba30716062b265f85c4be078a736c7135d7bc (patch) | |
| tree | dd079a2d3860349402ad5b614659fedcb90c2b99 /src/frontend/app/components/LineIcon.tsx | |
| parent | cee521142a4e0673b155d97c3e4825b7fec1987f (diff) | |
Refactor StopMap and Settings components; replace region config usage with REGION_DATA, update StopDataProvider calls, and improve UI elements. Remove unused timetable files and add Tailwind CSS support.
Diffstat (limited to 'src/frontend/app/components/LineIcon.tsx')
| -rw-r--r-- | src/frontend/app/components/LineIcon.tsx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/frontend/app/components/LineIcon.tsx b/src/frontend/app/components/LineIcon.tsx index 5ccf80a..fc40824 100644 --- a/src/frontend/app/components/LineIcon.tsx +++ b/src/frontend/app/components/LineIcon.tsx @@ -1,25 +1,23 @@ import React, { useMemo } from "react"; -import { type RegionId } from "../config/RegionConfig"; import "./LineIcon.css"; interface LineIconProps { line: string; - - /** - * @deprecated Unused since region is only Vigo - */ - region?: RegionId; - - mode?: "rounded"|"pill"|"default"; + mode?: "rounded" | "pill" | "default"; } const LineIcon: React.FC<LineIconProps> = ({ line, mode = "default", }) => { + const actualLine = useMemo(() => { + return line.trim().replace('510', 'NAD'); + }, [line]) + const formattedLine = useMemo(() => { - return /^[a-zA-Z]/.test(line) ? line : `L${line}`; - }, [line]); + return /^[a-zA-Z]/.test(actualLine) ? actualLine : `L${actualLine}`; + }, [actualLine]); + const cssVarName = `--line-${formattedLine.toLowerCase()}`; const cssTextVarName = `--line-${formattedLine.toLowerCase()}-text`; @@ -33,7 +31,7 @@ const LineIcon: React.FC<LineIconProps> = ({ } as React.CSSProperties } > - {line} + {actualLine} </span> ); }; |
