Skip to content

Commit

Permalink
[#415] Add text fields style configuration in theme
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea authored and florentmaitre committed Jan 31, 2023
1 parent 0389821 commit 612bca0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 37 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright 2021 Orange
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* /
*/

package com.orange.ods.theme

/**
* Contains all the allowed components customizations.
* This class can be extended to override default appearances.
*/
open class OdsComponentsConfiguration {

companion object {
enum class ComponentStyle {
Filled, Outlined
}
}

/**
* By default, the chips are outlined. If your theme needs to use filled chips, set this parameter to `ComponentStyle.Filled`.
*/
open val chipStyle: ComponentStyle = ComponentStyle.Outlined

/**
* By default, the text fields are outlined and more accessible in term of contrast like that. If your theme needs to use filled text fields, ser this parameter to `ComponentStyle.Filled`.
*/
open val textFieldStyle: ComponentStyle = ComponentStyle.Outlined
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ interface OdsThemeConfigurationContract : Parcelable {
/**
* Customization of the ODS components if needed
*/
val components: OdsComponentCustomizations
get() = OdsComponentCustomizations()
val components: OdsComponentsConfiguration
get() = OdsComponentsConfiguration()

/**
* Demo Guideline definition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ package com.orange.ods.theme.innovationcup
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.ui.unit.dp
import com.orange.ods.theme.OdsComponentCustomizations
import com.orange.ods.theme.OdsComponentCustomizations.Companion.ChipStyle
import com.orange.ods.theme.OdsComponentsConfiguration
import com.orange.ods.theme.OdsComponentsConfiguration.Companion.ComponentStyle
import com.orange.ods.theme.OdsThemeColors
import com.orange.ods.theme.OdsThemeConfigurationContract
import kotlinx.parcelize.Parcelize
Expand All @@ -35,10 +35,12 @@ class InnovationCupThemeConfiguration : OdsThemeConfigurationContract {
large = RoundedCornerShape(4.dp)
)

override val components: OdsComponentCustomizations
get() = object : OdsComponentCustomizations() {
override val chipStyle: ChipStyle
get() = ChipStyle.Filled
override val components: OdsComponentsConfiguration
get() = object : OdsComponentsConfiguration() {
override val chipStyle: ComponentStyle
get() = ComponentStyle.Filled
override val textFieldStyle: ComponentStyle
get() = ComponentStyle.Filled
}

}

0 comments on commit 612bca0

Please sign in to comment.