Skip to content

Commit

Permalink
[#111] Review: Set OdsDropdownMenuTrailing class to internal and rena…
Browse files Browse the repository at this point in the history
…me it to OdsExposedDropdownMenuTrailing
  • Loading branch information
paulinea committed Feb 1, 2023
1 parent d417a76 commit af7d533
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import com.orange.ods.compose.component.OdsComponentApi
import com.orange.ods.compose.component.textfield.OdsDropdownMenuTrailing
import com.orange.ods.compose.component.textfield.OdsExposedDropdownMenuTrailing
import com.orange.ods.compose.component.textfield.OdsTextField
import com.orange.ods.compose.component.utilities.BasicPreviewParameterProvider
import com.orange.ods.compose.component.utilities.Preview
Expand Down Expand Up @@ -68,7 +68,7 @@ fun OdsExposedDropdownMenu(
readOnly = true,
label = label,
leadingIcon = selectedItem.value.icon,
trailing = OdsDropdownMenuTrailing(expanded = if (enabled) expanded else false, enabled = enabled),
trailing = OdsExposedDropdownMenuTrailing(expanded = if (enabled) expanded else false, enabled = enabled),
enabled = enabled
)
OdsDropdownMenu(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fun OdsTextFieldCharacterCounter(valueLength: Int, maxChars: Int, enabled: Boole
sealed class OdsTextFieldTrailing
class OdsTextTrailing(val text: String) : OdsTextFieldTrailing()
class OdsIconTrailing(val painter: Painter, val contentDescription: String? = null, val onClick: () -> Unit = {}) : OdsTextFieldTrailing()
class OdsDropdownMenuTrailing(val expanded: Boolean, val enabled: Boolean) : OdsTextFieldTrailing()
internal class OdsExposedDropdownMenuTrailing(val expanded: Boolean, val enabled: Boolean) : OdsTextFieldTrailing()

@Composable
internal fun OdsTextFieldBottomRow(isError: Boolean, errorMessage: String?, characterCounter: (@Composable () -> Unit)?) {
Expand Down Expand Up @@ -105,7 +105,7 @@ internal fun getTrailing(trailing: OdsTextFieldTrailing, value: String, enabled:
)
}
}
is OdsDropdownMenuTrailing -> {
is OdsExposedDropdownMenuTrailing -> {
{
if (enabled) {
ExposedDropdownMenuDefaults.TrailingIcon(
Expand Down Expand Up @@ -141,7 +141,7 @@ internal fun getTrailingPreview(parameter: OdsTextFieldPreviewParameter, value:
val trailing = when (parameter.previewTrailingType) {
OdsTextTrailing::class -> OdsTextTrailing(text = "units")
OdsIconTrailing::class -> OdsIconTrailing(painter = painterResource(id = android.R.drawable.ic_input_add))
OdsDropdownMenuTrailing::class -> OdsDropdownMenuTrailing(expanded = false, enabled = true)
OdsExposedDropdownMenuTrailing::class -> OdsExposedDropdownMenuTrailing(expanded = false, enabled = true)
else -> null
}

Expand All @@ -160,7 +160,7 @@ internal class OdsTextFieldPreviewParameterProvider : BasicPreviewParameterProvi
private val previewParameterValues: List<OdsTextFieldPreviewParameter>
get() {
val booleanValues = listOf(true, false)
val trailings = listOf(null, OdsTextTrailing::class, OdsIconTrailing::class, OdsDropdownMenuTrailing::class)
val trailings = listOf(null, OdsTextTrailing::class, OdsIconTrailing::class, OdsExposedDropdownMenuTrailing::class)

return booleanValues.flatMap { hasCounter ->
booleanValues.flatMap { hasErrorMessage ->
Expand Down

0 comments on commit af7d533

Please sign in to comment.