Skip to content

Commit

Permalink
reskin wiki button
Browse files Browse the repository at this point in the history
  • Loading branch information
ManApart committed Dec 10, 2023
1 parent 0eb37a3 commit 8b59d47
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 23 deletions.
11 changes: 11 additions & 0 deletions src/jsMain/kotlin/components/Misc.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package components

import kotlinx.html.TagConsumer
import kotlinx.html.js.a
import org.w3c.dom.HTMLElement

fun TagConsumer<HTMLElement>.wikiLink(page: String) {
a("https://starfieldwiki.net/wiki/Starfield:$page", target = "_blank", classes = "a-button") {
+"Wiki"
}
}
11 changes: 2 additions & 9 deletions src/jsMain/kotlin/views/lifeSigns/FaunaView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ package views.lifeSigns
import FaunaWikiData
import components.counter
import components.screenshot
import doRouting
import el
import components.wikiLink
import faunaReference
import galaxy
import inMemoryStorage
import kotlinx.dom.addClass
import kotlinx.dom.removeClass
import kotlinx.html.*
import kotlinx.html.dom.append
import kotlinx.html.js.onClickFunction
import org.w3c.dom.HTMLElement
import persistMemory
Expand Down Expand Up @@ -61,10 +57,7 @@ private fun TagConsumer<HTMLElement>.display(fauna: FaunaWikiData, linkToSystem:
}
}
}
a("https://starfieldwiki.net/wiki/Starfield:${name.replace(" ", "_")}", target = "_blank") {
id = "wiki-link"
+"View on Wiki"
}
wikiLink(name.replace(" ", "_"))

table("scan-progress-table") {
if (fauna.planetId != null) {
Expand Down
6 changes: 2 additions & 4 deletions src/jsMain/kotlin/views/lifeSigns/FloraView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package views.lifeSigns
import FloraWikiData
import components.counter
import components.screenshot
import components.wikiLink
import el
import floraReference
import galaxy
Expand Down Expand Up @@ -57,10 +58,7 @@ private fun TagConsumer<HTMLElement>.display(flora: FloraWikiData, linkToSystem:
}
}
}
a("https://starfieldwiki.net/wiki/Starfield:${name.replace(" ", "_")}", target = "_blank") {
id = "wiki-link"
+"View on Wiki"
}
wikiLink(name.replace(" ", "_"))
table("scan-progress-table") {
if (flora.planetId != null) {
tr {
Expand Down
7 changes: 2 additions & 5 deletions src/jsMain/kotlin/views/system/PlanetView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PlanetScan
import StarSystem
import components.checkBox
import components.screenshot
import doRouting
import components.wikiLink
import inMemoryStorage
import kotlinx.html.*
import kotlinx.html.js.a
Expand Down Expand Up @@ -34,10 +34,7 @@ fun TagConsumer<HTMLElement>.detailView(system: StarSystem, planet: Planet, link
title = "Set course to ${planet.name} (requires docking)"
onClickFunction = { attemptTravel(planet.name) }
}
a("https://starfieldwiki.net/wiki/Starfield:${name.replace(" ", "_")}", target = "_blank") {
id = "wiki-link"
+"View on Wiki"
}
wikiLink(name.replace(" ", "_"))

checkBox("Initial Scan", info.scan::initialScan) {
replaceElement("${planet.uniqueId}-details") {
Expand Down
6 changes: 2 additions & 4 deletions src/jsMain/kotlin/views/system/StarView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package views.system
import Star
import StarSystem
import components.checkBox
import components.wikiLink
import inMemoryStorage
import kotlinx.html.*
import kotlinx.html.js.a
Expand All @@ -21,10 +22,7 @@ fun TagConsumer<HTMLElement>.detailView(star: Star, system: StarSystem, linkToSy
onClickFunction = { systemView(system, 0) }
}
}
a("https://starfieldwiki.net/wiki/Starfield:${name.replace(" ", "_")}", target = "_blank") {
id = "wiki-link"
+"View on Wiki"
}
wikiLink(name.replace(" ", "_"))

checkBox(star.id, "Discovered", inMemoryStorage::discoveredStars) {
replaceElement("${star.id}-details") {
Expand Down
21 changes: 21 additions & 0 deletions src/jsMain/resources/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ td {

button {
color: white;
font-size: 1em;
background-size: 200% 100%;
background-image: linear-gradient(to right, var(--background-blue) 50%, var(--menu-gray) 50%);
border: 1px solid gray;
Expand All @@ -79,6 +80,26 @@ button:hover{
background-position: -100% 0%;
}

.a-button {
display: inline-block;
color: white;
background-size: 200% 100%;
background-image: linear-gradient(to right, var(--background-blue) 50%, var(--menu-gray) 50%);
border: 1px solid gray;
padding: 5px;
margin-right: 5px;
margin-top: 5px;
margin-bottom: 5px;
cursor: pointer;
font-family: Architekt;
transition: 1s;
font-size: 1em;
}

.a-button:hover{
background-position: -100% 0%;
}

textarea {
color: white;
background-color: var(--background-blue);
Expand Down
2 changes: 1 addition & 1 deletion src/jsMain/resources/css/system.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
.planet-label {
}

#detail-view #wiki-link {
#detail-view .a-button {
display: inline-block;
}

Expand Down

0 comments on commit 8b59d47

Please sign in to comment.