Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/chips label component #41

Merged
merged 19 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0d8ddd5
feat: test theme ์ถ”๊ฐ€
BEEEAM-J Nov 30, 2023
6863881
Merge branch 'develop' into refactor/Beeeam-DesignSystem
BEEEAM-J Nov 30, 2023
a0e36c3
feat: contained label component ์ถ”๊ฐ€
BEEEAM-J Dec 3, 2023
1084344
feat: outlined label component ์ถ”๊ฐ€
BEEEAM-J Dec 3, 2023
ef2af52
rename: chips component ํด๋” ๋ฐ ๋ณ€์ˆ˜๋ช… ์ˆ˜์ •
BEEEAM-J Dec 4, 2023
11cce71
feat: Color chip ์ถ”๊ฐ€
BEEEAM-J Dec 4, 2023
a67d460
rename: Contained,Outlined chip ์ปดํฌ์ €๋ธ”๋ช… ์ˆ˜์ •
BEEEAM-J Dec 4, 2023
edfd21b
refactor: SuwikiChipType ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
98d8a29
remove: test theme ์ œ๊ฑฐ
BEEEAM-J Dec 5, 2023
724e7ac
refactor: ํด๋ฆญ ์ด๋ฒคํŠธ ์ธ์ž๋ช… ๋ฐ ๋žŒ๋‹ค ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
dfa60f0
refactor: Contained, Outlined, Color chip Stateless Composable๋กœ ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
ea4e674
refactor: Contained Chip ์ƒ‰ ์ •ํ•˜๋Š” ์กฐ๊ฑด์‹ ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
b2db94c
refactor: SuwikiCheckedColorChip, SuwikiNonCheckedColorChip -> Suwikiโ€ฆ
BEEEAM-J Dec 5, 2023
1940b2b
refactor: Contained, Outlined Chip width๊ฐ€ ๋™์ ์œผ๋กœ ๋ณ€ํ•˜๋„๋ก ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
469fe9b
Merge branch 'develop' into feature/chips-label-component
BEEEAM-J Dec 5, 2023
445dc2f
refactor: Contained, Outlined Chip ๋‚ด๋ถ€ ํ…์ŠคํŠธ ๋ฐฐ์น˜ ๋ฐฉ๋ฒ• ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
eafbe22
refactor: ๋ถ„๊ธฐ๊ฐ€ 2๊ฐœ์ธ when -> if
BEEEAM-J Dec 5, 2023
c36f3d6
refactor: Color Chip Image painterResource id ์„ค์ • ๊ฐ„์†Œํ™”
BEEEAM-J Dec 5, 2023
0b0d704
refactor: Outlined Chip ์ƒ‰ ์ •์˜ ๊ตฌ๋ฌธ ์ˆ˜์ •
BEEEAM-J Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.suwiki.core.designsystem.component.chips

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.suwiki.core.designsystem.R
import com.suwiki.core.designsystem.component.chips.ui.theme.TestTheme

@Composable
fun SuwikiCheckedColorChip(
onClicked: () -> Unit,
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
) {
Box(
modifier = Modifier.size(40.dp),
) {
Image(
painter = painterResource(id = R.drawable.ic_color_checked_chip),
contentDescription = "",
modifier = Modifier.clickable { onClicked() },
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
)
}
}

@Preview
@Composable
fun SuwikiCheckedColorChipPreview() {
TestTheme {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
SuwikiCheckedColorChip { }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.suwiki.core.designsystem.component.chips

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.suwiki.core.designsystem.component.chips.ui.theme.TestTheme

@Composable
fun SuwikiColorChip() {
var chipState by rememberSaveable { mutableStateOf(false) }
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved

when (chipState) {
true -> {
SuwikiCheckedColorChip { chipState = !chipState }
}
false -> {
SuwikiNonCheckedColorChip { chipState = !chipState }
}
}
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
}

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun SuwikiColorChipPreview() {
TestTheme {
Column(
modifier = Modifier.size(300.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
SuwikiColorChip()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package com.suwiki.core.designsystem.component.chips

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
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.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.suwiki.core.designsystem.component.chips.ui.theme.F6
import com.suwiki.core.designsystem.component.chips.ui.theme.TestTheme
import com.suwiki.core.designsystem.component.chips.ui.theme.blue10
import com.suwiki.core.designsystem.component.chips.ui.theme.blue100
import com.suwiki.core.designsystem.component.chips.ui.theme.c95
import com.suwiki.core.designsystem.component.chips.ui.theme.green10
import com.suwiki.core.designsystem.component.chips.ui.theme.green100
import com.suwiki.core.designsystem.component.chips.ui.theme.orange10
import com.suwiki.core.designsystem.component.chips.ui.theme.orange100
enum class SuwikiLabelType(val type: String) {
ORANGE("orange"),
BLUE("blue"),
GREEN("green"),
}
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved

@Composable
fun SuwikiContainedChip(type: SuwikiLabelType, text: String) {
var chipState by remember { mutableStateOf(false) }
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved

val backgroundColor: Color
val contentColor: Color

when (chipState) {
false -> {
backgroundColor = F6
contentColor = c95
}
true -> {
when (type) {
SuwikiLabelType.ORANGE -> {
backgroundColor = orange10
contentColor = orange100
}
SuwikiLabelType.BLUE -> {
backgroundColor = blue10
contentColor = blue100
}
SuwikiLabelType.GREEN -> {
backgroundColor = green10
contentColor = green100
}
}
}
}
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved

SuwikiContainedChipItem(
text = text,
backgroundColor = backgroundColor,
contentColor = contentColor,
onBtnClicked = { chipState = !chipState },
)
}

@Composable
fun SuwikiContainedChipItem(
text: String,
backgroundColor: Color,
contentColor: Color,
onBtnClicked: () -> Unit,
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
) {
Box(
modifier = Modifier
.clip(RoundedCornerShape(5.dp))
.background(color = backgroundColor)
.clickable { onBtnClicked() }
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
.size(41.dp, 26.dp),
) {
Text(
text = text,
color = contentColor,
modifier = Modifier
.align(Alignment.Center),
fontSize = 12.sp,
)
}
}

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun SuwikiContainedChipPreview() {
TestTheme {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
SuwikiContainedChip(SuwikiLabelType.ORANGE, "label")
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.suwiki.core.designsystem.component.chips

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.suwiki.core.designsystem.R
import com.suwiki.core.designsystem.component.chips.ui.theme.TestTheme

@Composable
fun SuwikiNonCheckedColorChip(
onClicked: () -> Unit,
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
) {
Box(
modifier = Modifier.size(40.dp),
) {
Image(
painter = painterResource(id = R.drawable.ic_color_chip),
contentDescription = "",
modifier = Modifier.clickable { onClicked() },
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
)
}
}

@Preview
@Composable
fun SuwikiNonCheckedColorChipPreview() {
TestTheme {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
SuwikiNonCheckedColorChip { }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.suwiki.core.designsystem.component.chips

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
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.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.suwiki.core.designsystem.component.chips.ui.theme.DA
import com.suwiki.core.designsystem.component.chips.ui.theme.Main
import com.suwiki.core.designsystem.component.chips.ui.theme.TestTheme
import com.suwiki.core.designsystem.component.chips.ui.theme.c95
import com.suwiki.core.designsystem.component.chips.ui.theme.white

@Composable
fun SuwikiOutlinedChip(text: String) {
var labelState by remember { mutableStateOf(false) }
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved

val backgroundColor: Color
val contentColor: Color

when (labelState) {
false -> {
backgroundColor = DA
contentColor = c95
}
true -> {
backgroundColor = Main
contentColor = Main
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
}
}

SuwikiOutlinedChipItem(
text = text,
backgroundColor = backgroundColor,
contentColor = contentColor,
onBtnClicked = { labelState = !labelState },
)
}

@Composable
fun SuwikiOutlinedChipItem(
text: String,
backgroundColor: Color,
contentColor: Color,
onBtnClicked: () -> Unit,
) {
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
Box(
modifier = Modifier
.clip(RoundedCornerShape(5.dp))
.clickable { onBtnClicked() }
.size(41.dp, 26.dp)
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
.background(color = white)
.border(width = 1.dp, color = backgroundColor, shape = RoundedCornerShape(5.dp)),
) {
Text(
text = text,
color = contentColor,
modifier = Modifier
.align(Alignment.Center),
fontSize = 12.sp,
)
}
}

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun SuwikiOutlinedChipPreview() {
TestTheme {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
SuwikiOutlinedChip("label")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.suwiki.core.designsystem.component.chips.ui.theme

import androidx.compose.ui.graphics.Color

val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

val Main = Color(0xFF346CFD)
val DA = Color(0xFFDADADA)
val F6 = Color(0xFFF6F6F6)
val c95 = Color(0xFF959595)
val orange10 = Color(0xFFFFF3EB)
val orange100 = Color(0xFFFD873B)
val blue10 = Color(0xFFECEDFF)
val blue100 = Color(0xFF3D4EFB)
val green10 = Color(0xFFEAF8EC)
val green100 = Color(0xFF2DB942)
val white = Color(0xFFFFFFFF)
BEEEAM-J marked this conversation as resolved.
Show resolved Hide resolved
Loading