Updated on 2026-08-14
This commit is contained in:
parent
331a15b433
commit
4d965de909
4 changed files with 143 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.feature.onboarding.presentation.wallet2.model
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
data class ButtonState(
|
||||
val enabled: Boolean = true,
|
||||
val showProgress: Boolean = false,
|
||||
val onClick: () -> Unit = {},
|
||||
) {
|
||||
val isClickable: Boolean = !showProgress
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.tangem.feature.onboarding.presentation.wallet2.model
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
data class OnboardingDescription(
|
||||
@StringRes val titleRes: Int? = null,
|
||||
@StringRes val subTitleRes: Int? = null,
|
||||
val title: String? = null,
|
||||
val subTitle: String? = null,
|
||||
) {
|
||||
fun hasTitle(): Boolean = title != null || titleRes != null
|
||||
|
||||
fun hasSubTitle(): Boolean = subTitle != null || subTitleRes != null
|
||||
|
||||
fun getTitle(context: Context): String = context.get(titleRes, title)
|
||||
|
||||
fun getSubTitle(context: Context): String = context.get(subTitleRes, subTitle)
|
||||
|
||||
private fun Context.get(@StringRes resId: Int?, text: String?): String {
|
||||
return resId?.let { this.getString(it) } ?: text ?: ""
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.tangem.feature.onboarding.presentation.wallet2.ui.components
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.SpacerH12
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Composable
|
||||
fun OnboardingActionBlock(
|
||||
firstActionContent: @Composable (() -> Unit)? = null,
|
||||
secondActionContent: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(
|
||||
top = 8.dp,
|
||||
bottom = 32.dp,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.align(Alignment.BottomCenter),
|
||||
) {
|
||||
firstActionContent?.invoke()
|
||||
if (firstActionContent != null && secondActionContent != null) SpacerH12()
|
||||
secondActionContent?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.tangem.feature.onboarding.presentation.wallet2.ui.components
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.SpacerH12
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.model.OnboardingDescription
|
||||
|
||||
@Composable
|
||||
fun OnboardingDescriptionBlock(
|
||||
modifier: Modifier = Modifier,
|
||||
descriptionsList: List<OnboardingDescription> = emptyList(),
|
||||
) {
|
||||
if (descriptionsList.isEmpty()) return
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp),
|
||||
) {
|
||||
if (descriptionsList.size == 1) {
|
||||
SingleDescription(descriptionsList[0])
|
||||
} else {
|
||||
CarouselDescription(descriptionsList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DescriptionTitleText(text: String) {
|
||||
Text(
|
||||
text = text,
|
||||
style = TangemTheme.typography.h2,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DescriptionSubTitleText(text: String) {
|
||||
Text(
|
||||
text = text,
|
||||
style = TangemTheme.typography.subtitle1,
|
||||
color = TangemTheme.colors.text.secondary,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SingleDescription(description: OnboardingDescription) {
|
||||
Column {
|
||||
DescriptionTitleText(text = description.getTitle(LocalContext.current))
|
||||
if (description.hasTitle()) SpacerH12()
|
||||
DescriptionSubTitleText(text = description.getSubTitle(LocalContext.current))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CarouselDescription(descriptionsList: List<OnboardingDescription>) {
|
||||
Box {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue