Skip to content

Commit

Permalink
Add banners standalone icon, tweak sample UI
Browse files Browse the repository at this point in the history
  • Loading branch information
rock3r committed Nov 27, 2024
1 parent 2ecec92 commit bc9ef53
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object StandaloneSampleIcons {
val welcome = PathIconKey("icons/meetNewUi.svg", StandaloneSampleIcons::class.java)

object Components {
val banners = PathIconKey("icons/components/banners.svg", StandaloneSampleIcons::class.java)
val borders = PathIconKey("icons/components/borders.svg", StandaloneSampleIcons::class.java)
val button = PathIconKey("icons/components/button.svg", StandaloneSampleIcons::class.java)
val checkbox = PathIconKey("icons/components/checkBox.svg", StandaloneSampleIcons::class.java)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
package org.jetbrains.jewel.samples.standalone.view.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.ui.component.ErrorBanner
import org.jetbrains.jewel.ui.component.GroupHeader
import org.jetbrains.jewel.ui.component.InformationBanner
import org.jetbrains.jewel.ui.component.SuccessBanner
import org.jetbrains.jewel.ui.component.Text
import org.jetbrains.jewel.ui.component.WarningBanner
import org.jetbrains.jewel.ui.theme.defaultBannerStyle

@Composable
internal fun Banners() {
Column(Modifier.fillMaxSize().background(Color.White).padding(16.dp)) {
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
GroupHeader("Default banner (aka editor banners)")

InformationBanner(
style = JewelTheme.defaultBannerStyle.information,
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
)
Spacer(modifier = Modifier.height(8.dp))

SuccessBanner(
style = JewelTheme.defaultBannerStyle.success,
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
)
Spacer(modifier = Modifier.height(8.dp))

WarningBanner(
style = JewelTheme.defaultBannerStyle.warning,
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
)
Spacer(modifier = Modifier.height(8.dp))

ErrorBanner(
style = JewelTheme.defaultBannerStyle.error,
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
)

Spacer(Modifier.height(0.dp)) // The column's arrangement will add 8+8 dps of spacing

GroupHeader("Inline banner")

Text("Coming soon...", color = JewelTheme.globalColors.text.disabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object ComponentsViewModel {
}
},
),
ViewInfo(title = "Banners", iconKey = StandaloneSampleIcons.jewelLogo, content = { Banners() }),
ViewInfo(title = "Banners", iconKey = StandaloneSampleIcons.Components.banners, content = { Banners() }),
)
var currentView by mutableStateOf(views.first())
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc9ef53

Please sign in to comment.