From 10567b96e425b7d31d50472c49ca325acb2649d8 Mon Sep 17 00:00:00 2001 From: sunghyun Date: Thu, 8 Aug 2024 19:09:49 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:lipstick:=20::=20Color=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/chat/designsystem/theme/Color.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 core/designsystem/src/main/java/com/chat/designsystem/theme/Color.kt diff --git a/core/designsystem/src/main/java/com/chat/designsystem/theme/Color.kt b/core/designsystem/src/main/java/com/chat/designsystem/theme/Color.kt new file mode 100644 index 0000000..4bb5fc6 --- /dev/null +++ b/core/designsystem/src/main/java/com/chat/designsystem/theme/Color.kt @@ -0,0 +1,7 @@ +package com.chat.designsystem.theme + +import androidx.compose.ui.graphics.Color + +val P1 = Color(0xFF6263FB) + +val N3 = Color(0xFFBBBBCC) \ No newline at end of file From b5da77efc378eb1af3808fddb990050978aa8386 Mon Sep 17 00:00:00 2001 From: sunghyun Date: Thu, 8 Aug 2024 19:09:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:lipstick:=20::=20GoSocketCheckbox=20?= =?UTF-8?q?=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/checkbox/GoSocketCheckbox.kt | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 core/designsystem/src/main/java/com/chat/designsystem/component/checkbox/GoSocketCheckbox.kt diff --git a/core/designsystem/src/main/java/com/chat/designsystem/component/checkbox/GoSocketCheckbox.kt b/core/designsystem/src/main/java/com/chat/designsystem/component/checkbox/GoSocketCheckbox.kt new file mode 100644 index 0000000..0c83b25 --- /dev/null +++ b/core/designsystem/src/main/java/com/chat/designsystem/component/checkbox/GoSocketCheckbox.kt @@ -0,0 +1,59 @@ +package com.chat.designsystem.component.checkbox + +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Checkbox +import androidx.compose.material3.CheckboxDefaults +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.chat.designsystem.theme.N3 +import com.chat.designsystem.theme.P1 +import com.chat.designsystem.util.clickableNoRipple + +@Composable +fun GoSocketCheckbox( + modifier: Modifier = Modifier, + checked: Boolean, + onCheckedChange: (Boolean) -> Unit, +) { + var isChecked by remember { mutableStateOf(checked) } + + Checkbox( + modifier = modifier + .size(20.dp) + .clip(RoundedCornerShape(8.dp)) + .border( + width = 2.dp, + color = if (isChecked) P1 else N3, + shape = RoundedCornerShape(8.dp) + ) + .clickableNoRipple { + isChecked = !isChecked + onCheckedChange(isChecked) + }, + checked = isChecked, + onCheckedChange = null, + colors = CheckboxDefaults.colors(checkedColor = P1) + ) +} + +@Preview +@Composable +fun GoSocketCheckboxPreview() { + Column { + GoSocketCheckbox(checked = true) {} + Spacer(modifier = Modifier.height(10.dp)) + GoSocketCheckbox(checked = false) {} + } +} \ No newline at end of file