Skip to content

Commit bdd3730

Browse files
committed
SALG-1278: Add designated btn for play and map toggle
1 parent 3c444e6 commit bdd3730

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

src/components/routes/Route.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { React, useEffect, useState } from "react";
22
import { Link } from "react-router-dom";
33
import useFetch from "../../util/useFetch";
44
import Image from "../Image";
5-
import { ReactComponent as CirclePlay } from "../../icons/circle-play-solid.svg";
65

76
function Route({ id }) {
87
const { data } = useFetch(`routes/${id}`);
@@ -22,7 +21,6 @@ function Route({ id }) {
2221
to={`/route/${id}`}
2322
>
2423
<div className="w-32 flex justify-center place-items-center">
25-
<CirclePlay className="absolute w-6" />
2624
<Image className="object-cover h-full" src={route.image} />
2725
</div>
2826
<div className="flex-initial text-left leading-none p-3">

src/components/routes/SelectedRoute.jsx

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { React, useEffect, useState } from "react";
22
import MapWrapper from "../map/MapWrapper";
33
import { getFeaturesForMap } from "../../util/helper";
44
import BackButton from "../BackButton";
5+
import { ReactComponent as IconCirclePlay } from "../../icons/circle-play-solid.svg";
6+
import { ReactComponent as IconMap } from "../../icons/map-solid.svg";
57

68
function SelectedRoute({ selectedRoute }) {
79
const [featuresForMap, setFeaturesForMap] = useState(null);
@@ -16,33 +18,57 @@ function SelectedRoute({ selectedRoute }) {
1618

1719
if (selectedRoute === null || featuresForMap === null) return null;
1820

21+
console.log(selectedRoute)
22+
1923
return (
2024
<>
2125
<MapWrapper mapData={featuresForMap} goToView={featuresForMap[0]} />
2226
<BackButton>Kategorier</BackButton>
2327
<div className="relative ml-2">
24-
<h1 className="text-4xl font-bold mt-10 mb-5">{selectedRoute.name}</h1>
25-
<div className="info-box bg-zinc-100 dark:bg-zinc-700 rounded p-3 w-32">
28+
{/* TODO: show the real category instead of "Valgt kategory" */}
29+
<p className="mt-10 text-sm font-bold text-emerald-800 dark:text-emerald-400 drop-shadow">Valgt kategori</p>
30+
<h1 className="text-4xl font-bold mb-5 drop-shadow">{selectedRoute.name}</h1>
31+
<div id="info-box" className="bg-zinc-100 dark:bg-zinc-700 rounded p-3 w-32 drop-shadow">
2632
<label htmlFor="distance" className="mb-5">
2733
<span className="text-xs">Distance</span>
2834
<div id="distance" className="text-lg">
2935
{selectedRoute.distance}
3036
</div>
3137
</label>
3238
<label htmlFor="poi" className="mb-5">
33-
<span className="text-xs">Dele</span>
39+
<span className="text-xs">Afsnit</span>
3440
<div id="poi" className="text-lg">
3541
{selectedRoute.pointsOfInterest.length}
3642
</div>
3743
</label>
38-
{/* todo skeleton screen (I think I recall tailwind having these ootb) or some wait indication */}
44+
{/* todo skeleton screen (I think I recall tailwind having these ootb) or some wait indication. https://tailwindcss.com/docs/animation#pulse */}
3945
{/* todo how to sum up podcasts */}
4046
<label htmlFor="length">
4147
<span className="text-xs">Afspilningstid</span>
4248
{/* todo */}
4349
<div id="length" className="text-lg" />
4450
</label>
4551
</div>
52+
<div id="buttons" className="relative mt-5 flex gap-3">
53+
<button
54+
className="p-2 rounded text-zinc-100 dark:text-zinc-800 bg-zinc-800 dark:bg-zinc-100 drop-shadow"
55+
type="button"
56+
// TODO: Change onClick to go to selected route
57+
//onClick={() => setSource(podcast)}
58+
>
59+
<IconCirclePlay className="w-6 h-6" />
60+
<span className="sr-only">Afspil</span>
61+
</button>
62+
<button
63+
className="p-2 rounded text-zinc-100 dark:text-zinc-800 bg-zinc-800 dark:bg-zinc-100 drop-shadow"
64+
type="button"
65+
// TODO: Change onClick to toggle map layer
66+
//onClick={() => setSource(podcast)}
67+
>
68+
<IconMap className="w-6 h-6" />
69+
<span className="sr-only">Vis kortet</span>
70+
</button>
71+
</div>
4672
</div>
4773
</>
4874
);

src/icons/map-solid.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)