From 6239d8c0c5498fde250f097ec3037eceffbedfca Mon Sep 17 00:00:00 2001 From: "C. Yang" Date: Fri, 5 Jan 2024 17:37:07 -0500 Subject: [PATCH] go to journal button --- src/ui.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ui.js b/src/ui.js index 4264489..d950ed5 100644 --- a/src/ui.js +++ b/src/ui.js @@ -57,9 +57,18 @@ export default class UIManager { fishInfo.innerHTML = `Name: ${fish.name}`; fishInfo.innerHTML += `
Mood: ${fish.mood}`; fishInfo.innerHTML += `
Favorite food: ${fish.favoriteFood}`; - + fishInfo.innerHTML += "
"; + + let fishLink = document.createElement("a"); + fishLink.href = "#journal"; + fishLink.innerText = "Go to journal"; + fishLink.addEventListener("click", function () { + this.setJournalSelected(fish); + }.bind(this)); + fishDiv.appendChild(fishImage); fishDiv.appendChild(fishInfo); + fishDiv.appendChild(fishLink); // Add it to the selected fish div selectedFishDiv.appendChild(fishDiv);