All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.github.lyxnx.compose.pine.StatusBoxDefaults.kt Maven / Gradle / Ivy

package io.github.lyxnx.compose.pine

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp

/**
 * Contains the default values used by a [StatusBox]
 */
public object StatusBoxDefaults {

    /**
     * Default content padding within a [StatusBox]
     */
    public val ContentPadding: PaddingValues = PaddingValues(12.dp)

    /**
     * Default size of the icon within a [StatusBox]
     */
    public val IconSize: DpSize = DpSize(24.dp, 24.dp)

    /**
     * Creates a [StatusBoxColors] instance for the given [style]
     */
    @Composable
    public fun statusBoxColors(style: StatusBoxStyle): StatusBoxColors = when (style) {
        StatusBoxStyle.Info -> StatusBoxColors(
            backgroundColor = PineTheme.colors.info100,
            borderColor = PineTheme.colors.info500,
            titleColor = PineTheme.colors.info800,
            messageColor = PineTheme.colors.info900,
            iconColor = PineTheme.colors.primary500
        )

        StatusBoxStyle.Warning -> StatusBoxColors(
            backgroundColor = PineTheme.colors.warning100,
            borderColor = PineTheme.colors.warning500,
            titleColor = PineTheme.colors.warning800,
            messageColor = PineTheme.colors.warning900,
            iconColor = PineTheme.colors.primary500
        )

        StatusBoxStyle.Error -> StatusBoxColors(
            backgroundColor = PineTheme.colors.error100,
            borderColor = PineTheme.colors.error500,
            titleColor = PineTheme.colors.error800,
            messageColor = PineTheme.colors.error900,
            iconColor = PineTheme.colors.primary500
        )

        StatusBoxStyle.Success -> StatusBoxColors(
            backgroundColor = PineTheme.colors.success100,
            borderColor = PineTheme.colors.success500,
            titleColor = PineTheme.colors.success800,
            messageColor = PineTheme.colors.success900,
            iconColor = PineTheme.colors.primary500
        )
    }

    /**
     * Creates a [StatusBoxColors] instance with the given colors
     */
    @Composable
    public fun statusBoxColors(
        backgroundColor: Color,
        borderColor: Color,
        titleColor: Color,
        messageColor: Color,
        iconColor: Color
    ): StatusBoxColors = StatusBoxColors(
        backgroundColor = backgroundColor,
        borderColor = borderColor,
        titleColor = titleColor,
        messageColor = messageColor,
        iconColor = iconColor
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy