diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-08 23:01:01 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-08 23:01:01 +0100 |
| commit | 2063f8101b1c887e079e11c96755a2441aa1b57b (patch) | |
| tree | 60b64c3567fa6d543c88bd0f827675df3b44ea90 /src/frontend/app/components/LineIcon.tsx | |
| parent | c3db1a9a85745597c1bec334443d630f009e30c8 (diff) | |
Rename LineIcon -> RouteIcon, fix some size issues
Diffstat (limited to 'src/frontend/app/components/LineIcon.tsx')
| -rw-r--r-- | src/frontend/app/components/LineIcon.tsx | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/frontend/app/components/LineIcon.tsx b/src/frontend/app/components/LineIcon.tsx deleted file mode 100644 index 5d85c60..0000000 --- a/src/frontend/app/components/LineIcon.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useMemo } from "react"; -import "./LineIcon.css"; - -interface LineIconProps { - line: string; - mode?: "rounded" | "pill" | "default"; - colour?: string; - textColour?: string; -} - -const LineIcon: React.FC<LineIconProps> = ({ - line, - mode = "default", - colour, - textColour, -}) => { - const actualLine = useMemo(() => { - return line.trim().replace("510", "NAD"); - }, [line]); - - const formattedLine = useMemo(() => { - return /^[a-zA-Z]/.test(actualLine) ? actualLine : `L${actualLine}`; - }, [actualLine]); - - const actualLineColour = useMemo(() => { - const actualColour = colour?.startsWith("#") ? colour : `#${colour}`; - return colour ? actualColour : `var(--line-${formattedLine.toLowerCase()})`; - }, [formattedLine]); - const actualTextColour = useMemo(() => { - const actualTextColour = textColour?.startsWith("#") - ? textColour - : `#${textColour}`; - return textColour - ? actualTextColour - : `var(--line-${formattedLine.toLowerCase()}-text, #000000)`; - }, [formattedLine]); - - return ( - <span - className={`line-icon-${mode}`} - style={ - { - "--line-colour": actualLineColour, - "--line-text-colour": actualTextColour, - } as React.CSSProperties - } - > - {actualLine} - </span> - ); -}; - -export default LineIcon; |
