-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/chips label component #41
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0d8ddd5
feat: test theme ์ถ๊ฐ
BEEEAM-J 6863881
Merge branch 'develop' into refactor/Beeeam-DesignSystem
BEEEAM-J a0e36c3
feat: contained label component ์ถ๊ฐ
BEEEAM-J 1084344
feat: outlined label component ์ถ๊ฐ
BEEEAM-J ef2af52
rename: chips component ํด๋ ๋ฐ ๋ณ์๋ช
์์
BEEEAM-J 11cce71
feat: Color chip ์ถ๊ฐ
BEEEAM-J a67d460
rename: Contained,Outlined chip ์ปดํฌ์ ๋ธ๋ช
์์
BEEEAM-J edfd21b
refactor: SuwikiChipType ์์
BEEEAM-J 98d8a29
remove: test theme ์ ๊ฑฐ
BEEEAM-J 724e7ac
refactor: ํด๋ฆญ ์ด๋ฒคํธ ์ธ์๋ช
๋ฐ ๋๋ค ์์
BEEEAM-J dfa60f0
refactor: Contained, Outlined, Color chip Stateless Composable๋ก ์์
BEEEAM-J ea4e674
refactor: Contained Chip ์ ์ ํ๋ ์กฐ๊ฑด์ ์์
BEEEAM-J b2db94c
refactor: SuwikiCheckedColorChip, SuwikiNonCheckedColorChip -> Suwikiโฆ
BEEEAM-J 1940b2b
refactor: Contained, Outlined Chip width๊ฐ ๋์ ์ผ๋ก ๋ณํ๋๋ก ์์
BEEEAM-J 469fe9b
Merge branch 'develop' into feature/chips-label-component
BEEEAM-J 445dc2f
refactor: Contained, Outlined Chip ๋ด๋ถ ํ
์คํธ ๋ฐฐ์น ๋ฐฉ๋ฒ ์์
BEEEAM-J eafbe22
refactor: ๋ถ๊ธฐ๊ฐ 2๊ฐ์ธ when -> if
BEEEAM-J c36f3d6
refactor: Color Chip Image painterResource id ์ค์ ๊ฐ์ํ
BEEEAM-J 0b0d704
refactor: Outlined Chip ์ ์ ์ ๊ตฌ๋ฌธ ์์
BEEEAM-J File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...esignsystem/src/main/java/com/suwiki/core/designsystem/component/chips/SuwikiColorChip.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.suwiki.core.designsystem.component.chips | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
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.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 | ||
|
||
@Composable | ||
fun SuwikiColorChip( | ||
isChecked: Boolean, | ||
onClick: () -> Unit = {}, | ||
) { | ||
Box( | ||
modifier = Modifier.size(40.dp), | ||
) { | ||
Image( | ||
painter = when (isChecked) { | ||
true -> { | ||
painterResource(id = R.drawable.ic_color_checked_chip) | ||
} | ||
false -> { | ||
painterResource(id = R.drawable.ic_color_chip) | ||
} | ||
}, | ||
contentDescription = "", | ||
modifier = Modifier.clickable(onClick = onClick), | ||
) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true, backgroundColor = 0xFFFFFF) | ||
@Composable | ||
fun SuwikiColorChipPreview() { | ||
var isChecked by rememberSaveable { mutableStateOf(false) } | ||
|
||
SuwikiColorChip( | ||
isChecked = isChecked, | ||
onClick = { isChecked = !isChecked } | ||
) | ||
} |
80 changes: 80 additions & 0 deletions
80
...nsystem/src/main/java/com/suwiki/core/designsystem/component/chips/SuwikiContainedChip.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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.height | ||
import androidx.compose.foundation.layout.padding | ||
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.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 | ||
enum class SuwikiChipType { | ||
ORANGE, | ||
BLUE, | ||
GREEN, | ||
} | ||
|
||
@Composable | ||
fun SuwikiContainedChip( | ||
isChecked: Boolean, | ||
onClick: () -> Unit = {}, | ||
type: SuwikiChipType, | ||
text: String, | ||
) { | ||
val (backgroundColor, contentColor) = when { | ||
isChecked -> { | ||
when (type) { | ||
SuwikiChipType.ORANGE -> Color(0xFFFFF3EB) to Color(0xFFFD873B) | ||
SuwikiChipType.BLUE -> Color(0xFFECEDFF) to Color(0xFF3D4EFB) | ||
SuwikiChipType.GREEN -> Color(0xFFEAF8EC) to Color(0xFF2DB942) | ||
} | ||
} | ||
else -> Color(0xFFF6F6F6) to Color(0xFF959595) | ||
} | ||
|
||
Box( | ||
modifier = Modifier | ||
.clip(RoundedCornerShape(5.dp)) | ||
.background(color = backgroundColor) | ||
.clickable(onClick = onClick) | ||
.height(26.dp) | ||
) { | ||
Column( | ||
BEEEAM-J marked this conversation as resolved.
Show resolved
Hide resolved
|
||
modifier = Modifier | ||
.padding(top = 4.dp, bottom = 4.dp, start = 6.dp, end = 6.dp) | ||
BEEEAM-J marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.height(18.dp), | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Text( | ||
text = text, | ||
color = contentColor, | ||
fontSize = 12.sp, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true, backgroundColor = 0xFFFFFF) | ||
@Composable | ||
fun SuwikiContainedChipPreview() { | ||
var isChecked by remember { mutableStateOf(false) } | ||
|
||
SuwikiContainedChip( | ||
isChecked = isChecked, | ||
onClick = { isChecked = !isChecked }, | ||
type = SuwikiChipType.GREEN, | ||
text = "label", | ||
) | ||
} |
78 changes: 78 additions & 0 deletions
78
...gnsystem/src/main/java/com/suwiki/core/designsystem/component/chips/SuwikiOutlinedChip.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
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.height | ||
import androidx.compose.foundation.layout.padding | ||
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.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 | ||
|
||
@Composable | ||
fun SuwikiOutlinedChip( | ||
text: String, | ||
isChecked: Boolean, | ||
onClick: () -> Unit = {}, | ||
) { | ||
val borderLineColor: Color | ||
val contentColor: Color | ||
|
||
when (isChecked) { | ||
false -> { | ||
borderLineColor = Color(0xFFDADADA) | ||
contentColor = Color(0xFF959595) | ||
} | ||
true -> { | ||
borderLineColor = Color(0xFF346CFD) | ||
contentColor = Color(0xFF346CFD) | ||
} | ||
} | ||
|
||
Box( | ||
modifier = Modifier | ||
.clip(RoundedCornerShape(5.dp)) | ||
.clickable(onClick = onClick) | ||
.height(26.dp) | ||
.background(color = Color(0xFFFFFFFF)) | ||
.border(width = 1.dp, color = borderLineColor, shape = RoundedCornerShape(5.dp)), | ||
) { | ||
Column( | ||
BEEEAM-J marked this conversation as resolved.
Show resolved
Hide resolved
|
||
modifier = Modifier | ||
.padding(top = 4.dp, bottom = 4.dp, start = 6.dp, end = 6.dp) | ||
BEEEAM-J marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.height(18.dp), | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Text( | ||
text = text, | ||
color = contentColor, | ||
fontSize = 12.sp, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true, backgroundColor = 0xFFFFFF) | ||
@Composable | ||
fun SuwikiOutlinedChipPreview() { | ||
var isChecked by remember { mutableStateOf(false) } | ||
|
||
SuwikiOutlinedChip( | ||
text = "label", | ||
isChecked = isChecked, | ||
onClick = { isChecked = !isChecked }, | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
core/designsystem/src/main/res/drawable/ic_color_checked_chip.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="40dp" | ||
android:height="40dp" | ||
android:viewportWidth="40" | ||
android:viewportHeight="40"> | ||
<path | ||
android:pathData="M20,0L20,0A20,20 0,0 1,40 20L40,20A20,20 0,0 1,20 40L20,40A20,20 0,0 1,0 20L0,20A20,20 0,0 1,20 0z" | ||
android:fillColor="#346CFD"/> | ||
<path | ||
android:pathData="M26.643,14.234C27.066,14.59 27.121,15.22 26.766,15.643L18.366,25.643C18.18,25.865 17.906,25.995 17.617,26C17.328,26.005 17.05,25.884 16.857,25.669L13.257,21.669C12.887,21.258 12.92,20.626 13.331,20.257C13.742,19.887 14.374,19.92 14.743,20.331L17.574,23.476L25.234,14.357C25.59,13.934 26.22,13.879 26.643,14.234Z" | ||
android:fillColor="#ffffff" | ||
android:fillType="evenOdd"/> | ||
</vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="40dp" | ||
android:height="40dp" | ||
android:viewportWidth="40" | ||
android:viewportHeight="40"> | ||
<path | ||
android:pathData="M20,0L20,0A20,20 0,0 1,40 20L40,20A20,20 0,0 1,20 40L20,40A20,20 0,0 1,0 20L0,20A20,20 0,0 1,20 0z" | ||
android:fillColor="#346CFD"/> | ||
</vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<resources> | ||
<string name="title_activity_main">MainActivity</string> | ||
</resources> | ||
</resources> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.