Skip to content

Commit

Permalink
fix: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-arshad-dev committed May 23, 2024
1 parent c6b32c5 commit 926facf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import org.openedx.core.extension.TextConverter
import org.openedx.core.ui.BackBtn
import org.openedx.core.ui.HandleUIMessage
import org.openedx.core.ui.HyperlinkText
import org.openedx.core.ui.OpenEdXSecondaryButton
import org.openedx.core.ui.OpenEdXButton
import org.openedx.core.ui.WindowSize
import org.openedx.core.ui.WindowType
import org.openedx.core.ui.displayCutoutForLandscape
Expand Down Expand Up @@ -274,9 +274,11 @@ private fun AuthForm(
if (state.showProgress) {
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
} else {
OpenEdXSecondaryButton(
OpenEdXButton(
modifier = buttonWidth.testTag("btn_sign_in"),
text = stringResource(id = coreR.string.core_sign_in),
textColor = MaterialTheme.appColors.primaryButtonText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBackground,
onClick = {
onEvent(AuthEvent.SignIn(login = login, password = password))
}
Expand Down Expand Up @@ -327,7 +329,7 @@ private fun PasswordTextField(
colors = TextFieldDefaults.outlinedTextFieldColors(
textColor = MaterialTheme.appColors.textFieldText,
backgroundColor = MaterialTheme.appColors.textFieldBackground,
focusedBorderColor = MaterialTheme.appColors.textFieldBorder,
unfocusedBorderColor = MaterialTheme.appColors.textFieldBorder,
cursorColor = MaterialTheme.appColors.textFieldText,
),
shape = MaterialTheme.appShapes.textFieldShape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import org.openedx.core.domain.model.RegistrationField
import org.openedx.core.domain.model.RegistrationFieldType
import org.openedx.core.ui.BackBtn
import org.openedx.core.ui.HandleUIMessage
import org.openedx.core.ui.OpenEdXSecondaryButton
import org.openedx.core.ui.OpenEdXButton
import org.openedx.core.ui.SheetContent
import org.openedx.core.ui.WindowSize
import org.openedx.core.ui.WindowType
Expand Down Expand Up @@ -434,9 +434,11 @@ internal fun SignUpView(
CircularProgressIndicator(color = MaterialTheme.appColors.primary)
}
} else {
OpenEdXSecondaryButton(
OpenEdXButton(
modifier = buttonWidth.testTag("btn_create_account"),
text = stringResource(id = R.string.auth_create_account),
textColor = MaterialTheme.appColors.primaryButtonText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBackground,
onClick = {
showErrorMap.clear()
onRegisterClick(AuthType.PASSWORD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fun LoginTextField(
colors = TextFieldDefaults.outlinedTextFieldColors(
textColor = MaterialTheme.appColors.textFieldText,
backgroundColor = MaterialTheme.appColors.textFieldBackground,
focusedBorderColor = MaterialTheme.appColors.textFieldBorder,
unfocusedBorderColor = MaterialTheme.appColors.textFieldBorder,
cursorColor = MaterialTheme.appColors.textFieldText,
),
shape = MaterialTheme.appShapes.textFieldShape,
Expand Down
56 changes: 12 additions & 44 deletions core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1045,25 +1045,6 @@ fun OfflineModeDialog(
}
}

@Composable
fun OpenEdXSecondaryButton(
modifier: Modifier = Modifier.fillMaxWidth(),
text: String = "",
onClick: () -> Unit,
enabled: Boolean = true,
content: (@Composable RowScope.() -> Unit)? = null
) {
OpenEdXButton(
modifier = modifier,
text = text,
onClick = onClick,
enabled = enabled,
textColor = MaterialTheme.appColors.primaryButtonText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBackground,
content = content
)
}

@Composable
fun OpenEdXButton(
modifier: Modifier = Modifier.fillMaxWidth(),
Expand Down Expand Up @@ -1099,26 +1080,6 @@ fun OpenEdXButton(
}
}

@Composable
fun OpenEdXSecondaryOutlinedButton(
modifier: Modifier = Modifier.fillMaxWidth(),
text: String = "",
onClick: () -> Unit,
enabled: Boolean = true,
content: (@Composable RowScope.() -> Unit)? = null
) {
OpenEdXOutlinedButton(
modifier = modifier,
text = text,
onClick = onClick,
enabled = enabled,
textColor = MaterialTheme.appColors.secondaryButtonBorderedText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBorderedBackground,
borderColor = MaterialTheme.appColors.secondaryButtonBorder,
content = content
)
}

@Composable
fun OpenEdXOutlinedButton(
modifier: Modifier = Modifier.fillMaxWidth(),
Expand Down Expand Up @@ -1203,11 +1164,13 @@ fun ConnectionErrorView(
textAlign = TextAlign.Center
)
Spacer(Modifier.height(16.dp))
OpenEdXSecondaryButton(
OpenEdXButton(
modifier = Modifier
.widthIn(Dp.Unspecified, 162.dp),
text = stringResource(id = R.string.core_reload),
onClick = onReloadClick
textColor = MaterialTheme.appColors.primaryButtonText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBackground,
onClick = onReloadClick,
)
}
}
Expand All @@ -1218,22 +1181,27 @@ fun AuthButtonsPanel(
onSignInClick: () -> Unit,
) {
Row {
OpenEdXSecondaryButton(
OpenEdXButton(
modifier = Modifier
.testTag("btn_register")
.width(0.dp)
.weight(1f),
text = stringResource(id = R.string.core_register),
textColor = MaterialTheme.appColors.primaryButtonText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBackground,
onClick = { onRegisterClick() }
)

OpenEdXSecondaryOutlinedButton(
OpenEdXOutlinedButton(
modifier = Modifier
.testTag("btn_sign_in")
.width(100.dp)
.padding(start = 16.dp),
text = stringResource(id = R.string.core_sign_in),
onClick = { onSignInClick() }
onClick = { onSignInClick() },
textColor = MaterialTheme.appColors.secondaryButtonBorderedText,
backgroundColor = MaterialTheme.appColors.secondaryButtonBorderedBackground,
borderColor = MaterialTheme.appColors.secondaryButtonBorder,
)
}
}
Expand Down

0 comments on commit 926facf

Please sign in to comment.