Added TypeScript for frontend
Added type definitions for components, functions, data Added guards for network responses fixes #8
This commit is contained in:
16
front/src/components/LineDot.tsx
Normal file
16
front/src/components/LineDot.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import { colors, lineNames } from '../assets/metro'
|
||||
import { lineByName } from '../utils/metro'
|
||||
|
||||
function LineDot({ station }: { station: string }) {
|
||||
const line = lineByName(station)
|
||||
|
||||
if (line == undefined)
|
||||
return <></>
|
||||
|
||||
const lineTitle = lineNames[line]
|
||||
const color = colors[line]
|
||||
|
||||
return <span title={`${lineTitle} ветка`} style={{ color: color }}>⬤</span>
|
||||
}
|
||||
|
||||
export default LineDot
|
Reference in New Issue
Block a user