summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/abstractionengine/ui/ArcadeButton.kt
blob: 9d50192994ee3bffc56c4b0a11cd373afcc3b9ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package coffee.liz.abstractionengine.ui

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

enum class ArcadeButtonColor {
    RED, YELLOW
}

@Composable
fun ArcadeButton(
    label: String,
    color: ArcadeButtonColor = ArcadeButtonColor.RED,
    onClick: () -> Unit,
    modifier: Modifier = Modifier
) {
    val buttonColor = when (color) {
        ArcadeButtonColor.RED -> GameBoyColors.ButtonRed
        ArcadeButtonColor.YELLOW -> GameBoyColors.ButtonYellow
    }

    Button(
        onClick = onClick,
        modifier = modifier
            .size(65.dp)
            .border(1.dp, MaterialTheme.colorScheme.outline, CircleShape),
        shape = CircleShape,
        colors = ButtonDefaults.buttonColors(
            containerColor = buttonColor,
            contentColor = MaterialTheme.colorScheme.onPrimary
        ),
        contentPadding = PaddingValues(0.dp)
    ) {
        Text(
            text = label,
            fontSize = 20.sp,
            fontWeight = FontWeight.Bold,
            color = MaterialTheme.colorScheme.onPrimary
        )
    }
}