diff --git a/api.md b/api.md index 07e4c47..e1df51f 100644 --- a/api.md +++ b/api.md @@ -22,7 +22,7 @@ ```ts { - Review[] + reviews: Review[] } ``` diff --git a/frontend/index.html b/frontend/index.html index 7ad0cc3..e504d7a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,6 +8,8 @@ Postnummer App + + diff --git a/frontend/src/main.ts b/frontend/src/main.ts index e0ec015..1b0b738 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -3,6 +3,7 @@ import { setTopbarOffset, addToggleDropdownListener } from "./topbar"; import { Coordinate, Position, convertPixelsToCoordinate, convertCoordinateToPixels } from "./coordinates"; import { Size } from "./size"; import { Tooltip } from "./Tooltip"; +import { loadReviews } from "./review"; const tooltip = new Tooltip(document.getElementById("tooltip")!); @@ -201,7 +202,7 @@ function pageRedirects() { reviewRedirect.addEventListener("click", () => { mainElement.innerHTML = `

Anmeldelser

-
` +
${loadReviews()}
` const dropdown = document.getElementById("dropdown")!; dropdown.classList.remove("enabled"); diff --git a/frontend/src/review.ts b/frontend/src/review.ts index eb36788..7587e7f 100644 --- a/frontend/src/review.ts +++ b/frontend/src/review.ts @@ -1,21 +1,28 @@ -const reviewContainer = document.getElementById("reviews-container")! -const reviewRedirect = document.getElementById("review-redirect")! -const main = document.getElementById("main")! -reviewRedirect.addEventListener("click", () => { - main.innerHTML = `

Anmeldelser

-
` +export function loadReviews() { + let result: string = "" -}); - -export function addReview(location: string, title: string, content: string, stars: number) { - const id = Math.random() * 1000000 - reviewContainer.innerHTML += - `
-

${title}

-

${location}

-

${content}

-

${stars} stjerner

+ result += ` +
+

Hvor er min scooter?

+
+

Randers

+
+ star + star + star + star + star +
+
+

lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet, lorem ipsum dolor sit amet

` + + // const body = (await (await fetch("/api/review")).json()).body() + + // if (!body.reviews) return; + + return result + } diff --git a/frontend/style.css b/frontend/style.css index 97324d8..8e9667f 100644 --- a/frontend/style.css +++ b/frontend/style.css @@ -227,3 +227,18 @@ code { justify-content: center; } +.review h3, p { + margin: 0; +} + +.location-and-stars { + display: flex; + justify-content: center; + padding: 0; + gap: 0.4em; + flex-direction: row; +} +.material-symbols-outlined { + color: yellow; + fill: yellow; +} \ No newline at end of file