Add ButtonIcon atom
This commit is contained in:
parent
d6f49b4919
commit
96b1fc2eb5
2 changed files with 43 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
package app.k9mail.core.ui.compose.designsystem.atom.button
|
||||
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import app.k9mail.core.ui.compose.theme.Icons
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
import androidx.compose.material.IconButton as MaterialIconButton
|
||||
|
||||
@Composable
|
||||
fun ButtonIcon(
|
||||
onClick: () -> Unit,
|
||||
imageVector: ImageVector,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
contentDescription: String? = null,
|
||||
) {
|
||||
MaterialIconButton(
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(MainTheme.sizes.icon),
|
||||
imageVector = imageVector,
|
||||
contentDescription = contentDescription,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
internal fun ButtonIconPreview() {
|
||||
ButtonIcon(
|
||||
onClick = { },
|
||||
imageVector = Icons.Filled.user,
|
||||
)
|
||||
}
|
|
@ -14,6 +14,8 @@ data class Sizes(
|
|||
val larger: Dp = 128.dp,
|
||||
val huge: Dp = 256.dp,
|
||||
val huger: Dp = 384.dp,
|
||||
|
||||
val icon: Dp = 24.dp,
|
||||
)
|
||||
|
||||
internal val LocalSizes = staticCompositionLocalOf { Sizes() }
|
||||
|
|
Loading…
Reference in a new issue