From b0a80f1fd48448394ec1aa06c353956d503fb2e2 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Sun, 21 Feb 2021 12:51:41 +0100 Subject: Refactor GlobalStyles centering classes --- .../org/luxons/sevenwonders/ui/components/GlobalStyles.kt | 12 ++++++------ .../luxons/sevenwonders/ui/components/game/PreparedMove.kt | 2 +- .../org/luxons/sevenwonders/ui/components/game/Tokens.kt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sw-ui') diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt index f9ea80b5..a4ffed64 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt @@ -27,15 +27,15 @@ object GlobalStyles : StyleSheet("GlobalStyles", isStatic = true) { val fixedCenter by css { position = Position.fixed - left = 50.pct - top = 50.pct - transform { - translate((-50).pct, (-50).pct) - } + +centerLeftTopTransform } - val centerInParent by css { + val centerInPositionedParent by css { position = Position.absolute + +centerLeftTopTransform + } + + val centerLeftTopTransform by css { left = 50.pct top = 50.pct transform { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt index 3cb230e0..1acaacdf 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt @@ -54,7 +54,7 @@ fun RBuilder.preparedMove( private fun StyledDOMBuilder
.discardText() { styledDiv { css { - +GlobalStyles.centerInParent + +GlobalStyles.centerInPositionedParent +GameStyles.discardMoveText } +"DISCARD" diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Tokens.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Tokens.kt index 846a9f07..3df359ed 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Tokens.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Tokens.kt @@ -112,7 +112,7 @@ fun RBuilder.tokenWithCount( tokenImage(tokenName, title = title, size = imgSize) styledSpan { css { - +GlobalStyles.centerInParent + +GlobalStyles.centerInPositionedParent tokenCountStyle(tokenCountSize, brightText, customCountStyle) } +"$count" -- cgit