Skip to content

Commit 5b99fe0

Browse files
committed
Route stop: Use <Link> instead of raw <a> tag
1 parent 33b6923 commit 5b99fe0

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

ui/src/components/routes-and-lines/line-details/RouteStopListItem.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FC } from 'react';
33
import { useTranslation } from 'react-i18next';
44
import { AiFillPlusCircle } from 'react-icons/ai';
55
import { MdHistory } from 'react-icons/md';
6+
import { Link } from 'react-router';
67
import { twMerge } from 'tailwind-merge';
78
import {
89
RouteStopFieldsFragment,
@@ -111,8 +112,8 @@ export const RouteStopListItem: FC<RouteStopListItemProps> = ({
111112
data-testid={testIds.container}
112113
>
113114
<div className="col-span-3 items-center justify-center text-center text-2xl">
114-
<a
115-
href={routeDetails[Path.stopDetails].getLink(stop.label, {
115+
<Link
116+
to={routeDetails[Path.stopDetails].getLink(stop.label, {
116117
observationDate,
117118
})}
118119
data-testid={testIds.label}
@@ -121,7 +122,7 @@ export const RouteStopListItem: FC<RouteStopListItemProps> = ({
121122
})}
122123
>
123124
{stop.label}
124-
</a>
125+
</Link>
125126
</div>
126127
<div className="col-span-9 flex items-center" data-testid={testIds.name}>
127128
<span>{stop.stop_place?.at(0)?.name?.value ?? '-'}</span>

ui/src/components/routes-and-lines/line-details/__snapshots__/LineRouteList.spec.tsx.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 2`] =
408408
class="col-span-3 items-center justify-center text-center text-2xl"
409409
>
410410
<a
411+
data-discover="true"
411412
data-testid="RouteStopListItem::label"
412413
href="/stop-registry/stops/H1234?observationDate=2017-02-14"
413414
title="Näytä pysäkin H1234 tiedot"
@@ -469,6 +470,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 2`] =
469470
</span>
470471
</div>
471472
</div>
473+
472474
<div
473475
class=""
474476
data-headlessui-state=""
@@ -515,6 +517,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 2`] =
515517
class="col-span-3 items-center justify-center text-center text-2xl"
516518
>
517519
<a
520+
data-discover="true"
518521
data-testid="RouteStopListItem::label"
519522
href="/stop-registry/stops/H1236?observationDate=2017-02-14"
520523
title="Näytä pysäkin H1236 tiedot"
@@ -576,6 +579,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 2`] =
576579
</span>
577580
</div>
578581
</div>
582+
579583
<div
580584
class=""
581585
data-headlessui-state=""
@@ -829,6 +833,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
829833
class="col-span-3 items-center justify-center text-center text-2xl"
830834
>
831835
<a
836+
data-discover="true"
832837
data-testid="RouteStopListItem::label"
833838
href="/stop-registry/stops/H1234?observationDate=2017-02-14"
834839
title="Näytä pysäkin H1234 tiedot"
@@ -890,6 +895,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
890895
</span>
891896
</div>
892897
</div>
898+
893899
<div
894900
class=""
895901
data-headlessui-state=""
@@ -936,6 +942,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
936942
class="col-span-3 items-center justify-center text-center text-2xl"
937943
>
938944
<a
945+
data-discover="true"
939946
data-testid="RouteStopListItem::label"
940947
href="/stop-registry/stops/H1235?observationDate=2017-02-14"
941948
title="Näytä pysäkin H1235 tiedot"
@@ -997,6 +1004,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
9971004
</span>
9981005
</div>
9991006
</div>
1007+
10001008
<div
10011009
class=""
10021010
data-headlessui-state=""
@@ -1043,6 +1051,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
10431051
class="col-span-3 items-center justify-center text-center text-2xl"
10441052
>
10451053
<a
1054+
data-discover="true"
10461055
data-testid="RouteStopListItem::label"
10471056
href="/stop-registry/stops/H1236?observationDate=2017-02-14"
10481057
title="Näytä pysäkin H1236 tiedot"
@@ -1104,6 +1113,7 @@ exports[`<LineRouteList /> Renders the route with stops along its geometry 3`] =
11041113
</span>
11051114
</div>
11061115
</div>
1116+
11071117
<div
11081118
class=""
11091119
data-headlessui-state=""

0 commit comments

Comments
 (0)