Skip to content

Commit

Permalink
Add samples to OudsButton KDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Dec 31, 2024
1 parent 5aa1054 commit 2fd0bbf
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ import kotlinx.parcelize.Parcelize
* Has no effect when [style] is equal to [OudsButton.Style.Loading].
* @param style The button style.
* @param hierarchy The button hierarchy.
*
* @sample com.orange.ouds.core.component.samples.OudsButtonWithTextSample
*/
@Composable
fun OudsButton(
Expand Down Expand Up @@ -123,6 +125,8 @@ fun OudsButton(
* Has no effect when [style] is equal to [OudsButton.Style.Loading].
* @param style The button style.
* @param hierarchy The button hierarchy.
*
* @sample com.orange.ouds.core.component.samples.OudsButtonWithIconSample
*/
@Composable
fun OudsButton(
Expand Down Expand Up @@ -157,6 +161,8 @@ fun OudsButton(
* Has no effect when [style] is equal to [OudsButton.Style.Loading].
* @param style The button style.
* @param hierarchy The button hierarchy.
*
* @sample com.orange.ouds.core.component.samples.OudsButtonWithIconAndTextSample
*/
@Composable
fun OudsButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import com.orange.ouds.theme.tokens.OudsSpaceKeyToken
* @param propagateMinConstraints Whether the incoming min constraints should be passed to content.
* @param content The content of this colored box.
*
* @sample com.orange.ouds.core.component.samples.SimpleOudsColoredBox
* @sample com.orange.ouds.core.component.samples.OudsColoredBoxSample
*/
@Composable
fun OudsColoredBox(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Software Name: OUDS Android
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.core.component.samples

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.orange.ouds.core.component.button.OudsButton

@Composable
fun OudsButtonWithTextSample() {
OudsButton(
text = "Text",
onClick = { /* Do something! */ }
)
}

@Composable
fun OudsButtonWithIconSample() {
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Icon content description"
),
onClick = { /* Do something! */ }
)
}

@Composable
fun OudsButtonWithIconAndTextSample() {
OudsButton(
icon = OudsButton.Icon(
painterResource(id = android.R.drawable.star_on),
"Icon content description"
),
text = "Text",
onClick = { /* Do something! */ }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken

@Composable
fun SimpleOudsColoredBox() {
fun OudsColoredBoxSample() {
OudsColoredBox(color = OudsColorKeyToken.Surface.Status.Info.Emphasized) {
// From this point LocalContentColor is automatically adjusted to maximize the contrast with OudsColorKeyToken.Surface.Status.Info.Emphasized
Text("Text")
Expand Down

0 comments on commit 2fd0bbf

Please sign in to comment.