Skip to content

Commit

Permalink
Onboarding design updates for tablet.
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviahandrea-vsp committed Aug 27, 2024
1 parent 84e75e6 commit f05b734
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
Expand Down Expand Up @@ -47,7 +46,6 @@ import org.permanent.permanent.R
import org.permanent.permanent.ui.composeComponents.ButtonColor
import org.permanent.permanent.ui.composeComponents.ButtonIconAlignment
import org.permanent.permanent.ui.composeComponents.SmallTextAndIconButton
import org.permanent.permanent.ui.composeComponents.TextAndIconButton


@Composable
Expand Down Expand Up @@ -200,10 +198,10 @@ private fun TabletBody(
horizontalArrangement = Arrangement.spacedBy(32.dp)
) {
Box(
modifier = Modifier.width(120.dp)
modifier = Modifier.weight(1f)
) {
SmallTextAndIconButton(
ButtonColor.TRANSPARENT,
buttonColor = ButtonColor.TRANSPARENT,
text = stringResource(id = R.string.back),
icon = painterResource(id = R.drawable.ic_arrow_back_rounded_white),
iconAlignment = ButtonIconAlignment.START
Expand All @@ -214,16 +212,20 @@ private fun TabletBody(
}
}

TextAndIconButton(
ButtonColor.LIGHT,
text = stringResource(id = R.string.create_the_archive),
showButtonEnabled = textFieldValueState.text.isNotEmpty()
Box(
modifier = Modifier.weight(1f)
) {
if (textFieldValueState.text.isNotEmpty()) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.GOALS.value)
SmallTextAndIconButton(
buttonColor = ButtonColor.LIGHT,
text = stringResource(id = R.string.next),
showButtonEnabled = textFieldValueState.text.isNotEmpty()
) {
if (textFieldValueState.text.isNotEmpty()) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.GOALS.value)
}
newArchive.name = textFieldValueState.text
}
newArchive.name = textFieldValueState.text
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ fun ArchiveOnboardingScreen(
GoalsPage(
viewModel = viewModel,
isTablet = isTablet,
horizontalPaddingDp = horizontalPaddingDp,
pagerState = pagerState,
newArchive = newArchive,
goals = goals
Expand All @@ -264,7 +263,6 @@ fun ArchiveOnboardingScreen(
PrioritiesPage(
viewModel = viewModel,
isTablet = isTablet,
horizontalPaddingDp = horizontalPaddingDp,
pagerState = pagerState,
newArchive = newArchive,
priorities = priorities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.PagerState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -42,7 +41,6 @@ import org.permanent.permanent.models.ArchiveType
import org.permanent.permanent.ui.composeComponents.ButtonColor
import org.permanent.permanent.ui.composeComponents.ButtonIconAlignment
import org.permanent.permanent.ui.composeComponents.SmallTextAndIconButton
import org.permanent.permanent.ui.composeComponents.TextAndIconButton

@Composable
fun ArchiveTypePage(
Expand Down Expand Up @@ -85,7 +83,7 @@ private fun TabletBody(
.weight(1f)
) {
val titleText = stringResource(id = R.string.create_your_first_archive_title)
val boldedWord = "archive"
val boldedWord = "Archive"
val start = titleText.indexOf(boldedWord)
val spanStyles = listOf(
AnnotatedString.Range(
Expand All @@ -110,7 +108,7 @@ private fun TabletBody(
.weight(1f), horizontalAlignment = Alignment.End
) {
Text(
text = stringResource(id = R.string.create_your_first_archive_description_tablet),
text = stringResource(id = R.string.create_your_first_archive_description),
fontSize = 16.sp,
lineHeight = 24.sp,
color = whiteColor,
Expand All @@ -131,33 +129,30 @@ private fun TabletBody(
horizontalArrangement = Arrangement.spacedBy(32.dp)
) {
Box(
modifier = Modifier.width(120.dp)
modifier = Modifier.weight(1f)
) {
SmallTextAndIconButton(
ButtonColor.TRANSPARENT,
text = stringResource(id = R.string.back),
icon = painterResource(id = R.drawable.ic_arrow_back_rounded_white),
iconAlignment = ButtonIconAlignment.START
) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.WELCOME.value)
SmallTextAndIconButton(
buttonColor = ButtonColor.TRANSPARENT,
text = stringResource(id = R.string.back),
icon = painterResource(id = R.drawable.ic_arrow_back_rounded_white),
iconAlignment = ButtonIconAlignment.START
) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.WELCOME.value)
}
}
}
}

val text =
if (archiveTypeName == context.getString(R.string.individual) || archiveTypeName == context.getString(
R.string.organization
)
) stringResource(
id = R.string.lets_create_an_archive, archiveTypeName
) else stringResource(id = R.string.lets_create_a_archive, archiveTypeName)

TextAndIconButton(
style = ButtonColor.LIGHT, text = text
Box(
modifier = Modifier.weight(1f)
) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.ARCHIVE_NAME.value)
SmallTextAndIconButton(
buttonColor = ButtonColor.LIGHT,
text = stringResource(id = R.string.next)
) {
coroutineScope.launch {
pagerState.animateScrollToPage(OnboardingPage.ARCHIVE_NAME.value)
}
}
}
}
Expand All @@ -181,7 +176,7 @@ private fun PhoneBody(
verticalArrangement = Arrangement.spacedBy(24.dp)
) {
val titleText = stringResource(id = R.string.create_your_first_archive_title)
val boldedWord = "archive"
val boldedWord = "Archive"
val start = titleText.indexOf(boldedWord)
val spanStyles = listOf(
AnnotatedString.Range(
Expand Down
Loading

0 comments on commit f05b734

Please sign in to comment.