diff --git a/components/Menu/SimpleDot.tsx b/components/Menu/SimpleDot.tsx new file mode 100644 index 0000000..b201bad --- /dev/null +++ b/components/Menu/SimpleDot.tsx @@ -0,0 +1,27 @@ +import React, { FC } from "react"; +import { Ionicons } from "@expo/vector-icons"; +import { TouchableOpacity } from "react-native"; +type SimpleDotProps = { + active: boolean; + onPress: () => void; +}; +export const SimpleDot: FC = (props) => { + const { active, onPress } = props; + return ( + + + + ); +}; diff --git a/components/Menu/StationPagination.tsx b/components/Menu/StationPagination.tsx index 1a1d036..fe1bb5b 100644 --- a/components/Menu/StationPagination.tsx +++ b/components/Menu/StationPagination.tsx @@ -17,40 +17,6 @@ type StationProps = { lat: number; lng: number; }; -type StationPaginationProps = { - entries: StationProps[][]; - activeSlide: number; - carouselRef: any; - setSelectedCurrentStation: React.Dispatch>; - dotButton: boolean; -}; - -export const Paginations: FC = (props) => { - const { entries, setSelectedCurrentStation } = props; - return ( - - ); -}; -type StationNumberMakerProps = { - currentStations: StationProps[][]; - setSelectedCurrentStation: React.Dispatch>; - active?: boolean; - index?: number; -}; -export const StationNumberMaker: FC = (props) => { - const { currentStations, active, index, setSelectedCurrentStation } = props; - return ( - setSelectedCurrentStation(index)} - key={currentStations[index][0].StationNumber} - /> - ); -}; type StationNumberProps = { currentStation: StationProps[]; active: boolean; @@ -68,41 +34,42 @@ export const StationNumber: FC = (props) => { const lineID = data[animation].StationNumber.slice(0, 1); const lineName = data[animation].StationNumber.slice(1); const size = active ? 24 : 18; - const margin = active ? 3 : 6; - const border = active ? 2 : 1; return ( - <> + {active && ( - - )} - = (props) => { {lineID + "\n" + lineName} - - + + ); }; diff --git a/menu.js b/menu.js index 61ec88e..0aca506 100644 --- a/menu.js +++ b/menu.js @@ -36,6 +36,7 @@ import { useStationList } from "./stateBox/useStationList"; import { StationNumber } from "./components/Menu/StationPagination"; import lineColorList from "./assets/originData/lineColorList"; import { AS } from "./storageControl"; +import { SimpleDot } from "./components/Menu/SimpleDot"; export default function Menu({ getCurrentTrain }) { const { navigate } = useNavigation(); @@ -244,13 +245,26 @@ export default function Menu({ getCurrentTrain }) { > {originalStationList && allStationData.map((d, index) => { - return ( - setSelectedCurrentStation(index)} - /> - ); + const active = index == selectedCurrentStation; + const numberIndex = d[0].StationNumber; + if (dotButton) { + return ( + setSelectedCurrentStation(index)} + currentStation={d} + active={active} + index={numberIndex} + /> + ); + } else { + return ( + setSelectedCurrentStation(index)} + active={active} + index={numberIndex} + /> + ); + } })}