diff --git a/client/src/components/SearchBar/SearchBar.tsx b/client/src/components/SearchBar/SearchBar.tsx index 7b1ee58b902..73df12fe103 100644 --- a/client/src/components/SearchBar/SearchBar.tsx +++ b/client/src/components/SearchBar/SearchBar.tsx @@ -16,6 +16,7 @@ import { useRef, useState } from 'react'; import logo from '../../static/img/otp-logo.svg'; import GraphiQLRouteButton from './GraphiQLRouteButton.tsx'; import WheelchairAccessibleCheckBox from './WheelchairAccessibleCheckBox.tsx'; +import { SwapLocationsButton } from './SwapLocationsButton.tsx'; type SearchBarProps = { onRoute: () => void; @@ -38,6 +39,7 @@ export function SearchBar({ onRoute, tripQueryVariables, setTripQueryVariables, + diff --git a/client/src/components/SearchBar/SwapLocationsButton.tsx b/client/src/components/SearchBar/SwapLocationsButton.tsx new file mode 100644 index 00000000000..28d25f2fac7 --- /dev/null +++ b/client/src/components/SearchBar/SwapLocationsButton.tsx @@ -0,0 +1,24 @@ +import { TripQueryVariables } from '../../gql/graphql.ts'; +import icon from '../../static/img/swap.svg'; + +export function SwapLocationsButton({ + tripQueryVariables, + setTripQueryVariables, +}: { + tripQueryVariables: TripQueryVariables; + setTripQueryVariables: (tripQueryVariables: TripQueryVariables) => void; +}) { + const swapFromTo = () => { + setTripQueryVariables({ + ...tripQueryVariables, + from: tripQueryVariables.to, + to: tripQueryVariables.from, + }); + }; + + return ( + + ); +} diff --git a/client/src/static/img/swap.svg b/client/src/static/img/swap.svg new file mode 100644 index 00000000000..858e5e99831 --- /dev/null +++ b/client/src/static/img/swap.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/client/src/style.css b/client/src/style.css index 86310fd857d..e5815d24c12 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -67,6 +67,16 @@ margin-top: -2px; } +.search-bar .swap-from-to { + border: none; + background: none; + margin: 30px 0 auto 0; +} + +.search-bar .swap-from-to img { + width: 15px; +} + .itinerary-list-container { width: 36rem; overflow-y: auto;