Skip to content

Commit

Permalink
fix: make normal space search card smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
d1snin committed Aug 10, 2023
1 parent 0c108ef commit ac610a1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@
package dev.d1s.beam.ui.component

import dev.d1s.beam.ui.theme.currentTheme
import dev.d1s.beam.ui.util.Size
import dev.d1s.beam.ui.util.Texts
import io.kvision.html.image
import io.kvision.panel.SimplePanel
import io.kvision.utils.perc
import io.kvision.utils.px
import io.kvision.utils.rem
import org.koin.core.component.KoinComponent

class NormalSpaceSearchCardContent : SpaceSearchCardContent, KoinComponent {

override val mode = SpaceSearchCardComponent.Mode.NORMAL

override fun SimplePanel.configureContainer() {
maxWidth = Size.Md.px
fontSize = 0.8.rem
}

override fun SimplePanel.image() {
image(
currentTheme.normalSpaceIcon,
Expand All @@ -38,6 +46,6 @@ class NormalSpaceSearchCardContent : SpaceSearchCardContent, KoinComponent {
}

override fun SimplePanel.text() {
spaceSearchCardText(Texts.Body.SpaceSearchCard.NormalMode.TEXT)
spaceSearchCardText(Texts.Body.SpaceSearchCard.NormalMode.TEXT, fontSize = 1.1.rem)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class SpaceSearchCardComponent : Component<SpaceSearchCardComponent.Config>(::Co

override fun SimplePanel.render() {
div(className = "container d-flex justify-content-center") {
maxWidth = Size.LgBreakpoint.px
maxWidth = Size.Lg.px

configureContainer()

card(className = "d-flex flex-column justify-content-center w-100 p-5") {
image()
Expand All @@ -74,6 +76,12 @@ class SpaceSearchCardComponent : Component<SpaceSearchCardComponent.Config>(::Co
}
}

private fun SimplePanel.configureContainer() {
with(content) {
configureContainer()
}
}

private fun SimplePanel.image() {
with(content) {
image()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package dev.d1s.beam.ui.component

import io.kvision.core.CssSize
import io.kvision.html.p
import io.kvision.panel.SimplePanel
import io.kvision.utils.rem
Expand All @@ -24,13 +25,17 @@ interface SpaceSearchCardContent {

val mode: SpaceSearchCardComponent.Mode

fun SimplePanel.configureContainer() {
// nop
}

fun SimplePanel.image()

fun SimplePanel.text()
}

fun SimplePanel.spaceSearchCardText(text: String) {
fun SimplePanel.spaceSearchCardText(text: String, fontSize: CssSize = 1.6.rem) {
p(text, className = "mb-3") {
fontSize = 1.6.rem
this.fontSize = fontSize
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ class CurrentSpaceContentChangeObservable : Observable<CurrentSpaceContentChange

private inline fun Blocks?.modifyBlocks(modification: MutableList<Block>. () -> Unit): Blocks =
this?.let {
this.toMutableList().apply(modification)
this.toMutableList().apply(modification).sortedBy {
it.index
}
} ?: listOf()

private fun setCurrentSpaceContentChange(change: CurrentSpaceContentChange) {
Expand Down

0 comments on commit ac610a1

Please sign in to comment.