Skip to content

Commit

Permalink
Include more examples in app and stable Pay Module with documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Apr 9, 2024
1 parent f8f7a14 commit 68e94c9
Show file tree
Hide file tree
Showing 264 changed files with 21,053 additions and 3,963 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ data class MenuOptions(
id = DestinationsIds.toolbars,
name = Names.toolbars
),
MenuOptions(
id = DestinationsIds.cards,
name = Names.cards
),
)

val buttons = listOf(
Expand Down Expand Up @@ -70,5 +74,12 @@ data class MenuOptions(
name = Names.largeToolbars
),
)

val cards = listOf(
MenuOptions(
id = DestinationsIds.benefitCards,
name = Names.benefitCards
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Destinations(private val navController: NavHostController) {
val goToSimpleToolbars: () -> Unit = { Feature.SIMPLE_TOOLBARS.route.navigate() }
val goToCenterToolbars: () -> Unit = { Feature.CENTER_TOOBARS.route.navigate() }
val goToLargeToolbars: () -> Unit = { Feature.LARGE_TOOBARS.route.navigate() }
val goToCards: () -> Unit = { Feature.CARDS.route.navigate() }
val goToBenefitCards: () -> Unit = { Feature.BENEFIT_CARDS.route.navigate() }

val goBack: (from: NavBackStackEntry) -> Unit = { from ->
if (from.lifecycleIsResumed()) navController.popBackStack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@ package com.jeluchu.composer.core.ui.navigation

enum class Feature(val route: String) {
DASHBOARD("dashboard"),

// Buttons
BUTTONS("buttons"),
FLOATING_BUTTONS("floating_buttons"),

// Progress
PROGRESS("progress"),
LINEAR_PROGRESS("linear_progress"),
ICON_PROGRESS("icon_progress"),

// Lists
LAZY_GRIDS("lazy_grids"),
LAZY_STATIC_GRIDS("lazy_static_grids"),

// Dividers
DIVIDERS("dividers"),

// Toolbars
TOOLBARS("toolbars"),
SIMPLE_TOOLBARS("simple_toolbars"),
CENTER_TOOBARS("center_toolbars"),
LARGE_TOOBARS("large_toolbars"),

// Cards
CARDS("cards"),
BENEFIT_CARDS("benefitCards"),
}

val Feature.baseRoute: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import com.jeluchu.composer.core.utils.DestinationsIds
import com.jeluchu.composer.core.utils.NavigationIds
import com.jeluchu.composer.features.bottons.view.ButtonsView
import com.jeluchu.composer.features.bottons.view.FloatingButtonView
import com.jeluchu.composer.features.cards.view.BenefitsView
import com.jeluchu.composer.features.cards.view.CardsView
import com.jeluchu.composer.features.dashboard.view.MainView
import com.jeluchu.composer.features.dividers.view.DividersView
import com.jeluchu.composer.features.lists.view.LazyGridsView
Expand All @@ -26,6 +28,7 @@ fun NavGraphBuilder.dashboardNav(nav: Destinations) {
DestinationsIds.lazyGrids -> nav.goToLazyGrids()
DestinationsIds.dividers -> nav.goToDividers()
DestinationsIds.toolbars -> nav.goToToolbars()
DestinationsIds.cards -> nav.goToCards()
}
}
}
Expand Down Expand Up @@ -147,4 +150,28 @@ fun NavGraphBuilder.toolbarsNav(nav: Destinations) {
CenterToolbarActionsPreview()
}
}
}

fun NavGraphBuilder.cardsNav(nav: Destinations) {
navigation(
startDestination = Feature.CARDS.route,
route = NavigationIds.cards
) {
composable(Feature.CARDS.nav) {
CardsView { id ->
when (id) {
DestinationsIds.benefitCards -> nav.goToBenefitCards()
DestinationsIds.back -> nav.goBack(it)
}
}
}

composable(Feature.BENEFIT_CARDS.nav) {
BenefitsView { id ->
when (id) {
DestinationsIds.back -> nav.goBack(it)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fun Navigation() = ProvideNavHostController { navHost ->
lazyGridsNav(nav)
dividersNav(nav)
toolbarsNav(nav)
cardsNav(nav)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ object DestinationsIds {
const val simpleToolbars = "toolbars"
const val centerToolbars = "centerToolbars"
const val largeToolbars = "largeToolbars"

const val cards = "cards"
const val benefitCards = "benefitCards"
}

object NavigationIds {
Expand All @@ -27,6 +30,7 @@ object NavigationIds {
const val lazyGrids = "lazyGridsNav"
const val dividers = "dividersNav"
const val toolbars = "toolbarsNav"
const val cards = "cardsNav"
}

object Names {
Expand All @@ -41,4 +45,6 @@ object Names {
const val toolbars = "Toolbars"
const val centerToolbars = "CenterToolbars"
const val largeToolbars = "LargeToolbars"
const val cards = "Cards"
const val benefitCards = "BenefitCards"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.jeluchu.composer.features.cards.view

import androidx.compose.runtime.Composable
import com.jeluchu.composer.core.ui.composables.ScaffoldStructure
import com.jeluchu.composer.core.ui.theme.milky
import com.jeluchu.composer.core.ui.theme.secondary
import com.jeluchu.composer.core.utils.DestinationsIds
import com.jeluchu.composer.core.utils.Names
import com.jeluchu.jchucomponents.ui.accompanist.systemui.SystemStatusBarColors
import com.jeluchu.jchucomponents.ui.composables.cards.BenefitsCardPreview
import com.jeluchu.jchucomponents.ui.composables.toolbars.CenterToolbarColors

@Composable
fun BenefitsView(onItemClick: (String) -> Unit) {
SystemStatusBarColors(
systemBarsColor = secondary,
statusBarColor = secondary
)

Benefits(onItemClick)
}

@Composable
private fun Benefits(
onItemClick: (String) -> Unit
) = ScaffoldStructure(
title = Names.benefitCards,
colors = CenterToolbarColors(
containerColor = secondary,
contentColor = milky
),
onNavIconClick = { onItemClick(DestinationsIds.back) }
) { BenefitsCardPreview() }
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.jeluchu.composer.features.cards.view

import androidx.compose.foundation.background
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import com.jeluchu.composer.core.commons.models.MenuOptions
import com.jeluchu.composer.core.ui.composables.ScaffoldStructure
import com.jeluchu.composer.core.ui.composables.SimpleButton
import com.jeluchu.composer.core.ui.theme.milky
import com.jeluchu.composer.core.ui.theme.primary
import com.jeluchu.composer.core.ui.theme.secondary
import com.jeluchu.composer.core.utils.DestinationsIds
import com.jeluchu.composer.core.utils.Names
import com.jeluchu.jchucomponents.ui.accompanist.systemui.SystemStatusBarColors
import com.jeluchu.jchucomponents.ui.composables.toolbars.CenterToolbarColors
import com.jeluchu.jchucomponents.ui.extensions.modifier.cornerRadius

@Composable
fun CardsView(onItemClick: (String) -> Unit) {
SystemStatusBarColors(
systemBarsColor = secondary,
statusBarColor = secondary
)

Toolbars(onItemClick)
}

@Composable
private fun Toolbars(
onItemClick: (String) -> Unit
) = ScaffoldStructure(
title = Names.cards,
colors = CenterToolbarColors(
containerColor = secondary,
contentColor = milky
),
onNavIconClick = { onItemClick(DestinationsIds.back) }
) {
MenuOptions.cards.forEach { option ->
SimpleButton(
modifier = Modifier
.clip(10.cornerRadius())
.background(primary.copy(.7f)),
label = option.name,
color = Color.DarkGray
) { onItemClick(option.id) }
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ plugins {
id("org.jetbrains.dokka") version "1.9.20" apply true
}

val currentVersion = "2.0.0-alpha08"
val currentVersion = "2.0.0-alpha09"
val previousVersionsDirectory = project.rootProject.projectDir.resolve("previousDocVersions").invariantSeparatorsPath

tasks.dokkaHtmlMultiModule {
Expand Down
Loading

0 comments on commit 68e94c9

Please sign in to comment.