-
Notifications
You must be signed in to change notification settings - Fork 0
feat: DesignSystem 초기 구성 #32
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
Changes from 14 commits
6127d1d
c52bf60
f2daaa2
a6bf393
0d3f162
c53958f
ec50d1d
d8a242a
c75a936
73f9225
1cea3ed
ad472f7
5a9647a
dc5e229
a1e543a
fe39f1b
aa9de70
4581c71
8e29b2f
03eefb2
e2342e6
75e676f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| package com.ninecraft.booket.core.designsystem.component.appbar | ||
|
|
||
| import android.support.annotation.DrawableRes | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxHeight | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.IconButton | ||
| import androidx.compose.material3.Text | ||
| 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.text.style.TextAlign | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.ninecraft.booket.core.designsystem.R | ||
| import com.ninecraft.booket.core.designsystem.theme.ReedTheme | ||
| import com.ninecraft.booket.core.designsystem.theme.White | ||
|
|
||
| @Composable | ||
| fun ReedTopAppBar( | ||
| modifier: Modifier = Modifier, | ||
| title: String = "", | ||
| @DrawableRes startIconRes: Int? = null, | ||
| startIconDescription: String = "", | ||
| startIconOnClick: () -> Unit = {}, | ||
| @DrawableRes endIconRes: Int? = null, | ||
| endIconDescription: String = "", | ||
| endIconOnClick: () -> Unit = {}, | ||
| ) { | ||
| Row( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .height(56.dp) | ||
| .background(color = White), | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| horizontalArrangement = Arrangement.Start, | ||
| ) { | ||
| if (startIconRes != null) { | ||
| IconButton( | ||
| onClick = { startIconOnClick() }, | ||
| modifier = Modifier | ||
| .fillMaxHeight() | ||
| .width(72.dp), | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(id = startIconRes), | ||
| contentDescription = startIconDescription, | ||
| ) | ||
| } | ||
| } else { | ||
| Spacer(modifier = Modifier.width(72.dp)) | ||
| } | ||
|
|
||
| Text( | ||
| text = title, | ||
| style = ReedTheme.typography.heading2SemiBold, | ||
| modifier = Modifier.weight(1f), | ||
| textAlign = TextAlign.Center, | ||
| ) | ||
|
|
||
| if (endIconRes != null) { | ||
| IconButton( | ||
| onClick = { endIconOnClick() }, | ||
| modifier = Modifier | ||
| .fillMaxHeight() | ||
| .width(72.dp), | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(id = endIconRes), | ||
| contentDescription = endIconDescription, | ||
| ) | ||
| } | ||
| } else { | ||
| Spacer(modifier = Modifier.width(72.dp)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| fun ReedBackTopAppBar( | ||
| modifier: Modifier = Modifier, | ||
| title: String = "", | ||
| onNavigateBack: () -> Unit = {}, | ||
| ) { | ||
| ReedTopAppBar( | ||
| modifier = modifier, | ||
| title = title, | ||
| startIconRes = R.drawable.ic_chevron_left, | ||
| startIconDescription = "Back", | ||
| startIconOnClick = onNavigateBack, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| fun ReedCloseTopAppBar( | ||
| modifier: Modifier = Modifier, | ||
| title: String = "", | ||
| onClose: () -> Unit = {}, | ||
| ) { | ||
| ReedTopAppBar( | ||
| modifier = modifier, | ||
| title = title, | ||
| endIconRes = R.drawable.ic_close, | ||
| startIconDescription = "Close", | ||
| startIconOnClick = onClose, | ||
| ) | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| @Preview | ||
| @Composable | ||
| fun ReedTopAppBarPreview() { | ||
| ReedTopAppBar( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preview 함수는 다른 곳에서 사용되지 않는 관계로 private 접근 제어자 붙여주고, ReedTheme으로 감싸주면 될것같음
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 수정 완료 4581c71 |
||
| title = "title", | ||
| ) | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| fun ReedBackTopAppBarPreview() { | ||
| ReedBackTopAppBar( | ||
| title = "title", | ||
| ) | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| fun ReedCloseTopAppBarPreview() { | ||
| ReedCloseTopAppBar( | ||
| title = "title", | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package com.ninecraft.booket.core.designsystem.component | ||
| package com.ninecraft.booket.core.designsystem.component.button | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 패키지·네이밍이 혼재됨 – Booket vs Reed 패키지를
중 하나를 고려해 주세요. 🤖 Prompt for AI Agents |
||
|
|
||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.padding | ||
|
|
@@ -19,7 +19,7 @@ import androidx.compose.ui.unit.dp | |
| import com.ninecraft.booket.core.common.utils.MultipleEventsCutter | ||
| import com.ninecraft.booket.core.common.utils.get | ||
| import com.ninecraft.booket.core.designsystem.ComponentPreview | ||
| import com.ninecraft.booket.core.designsystem.theme.BooketTheme | ||
| import com.ninecraft.booket.core.designsystem.theme.ReedTheme | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ReedTheme 색상 정의 미흡 시 Button 색상도 영향을 받음
🤖 Prompt for AI Agents |
||
| @Composable | ||
| fun BooketButton( | ||
|
|
@@ -85,7 +85,7 @@ private fun BooketButtonContent( | |
| @ComponentPreview | ||
| @Composable | ||
| private fun BooketButtonPreview() { | ||
| BooketTheme { | ||
| ReedTheme { | ||
| BooketButton( | ||
| onClick = {}, | ||
| text = { | ||
|
|
@@ -98,7 +98,7 @@ private fun BooketButtonPreview() { | |
| @ComponentPreview | ||
| @Composable | ||
| private fun BooketButtonWithLeadingIconPreview() { | ||
| BooketTheme { | ||
| ReedTheme { | ||
| BooketButton( | ||
| onClick = {}, | ||
| text = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||
| package com.ninecraft.booket.core.designsystem.component.button | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import androidx.compose.runtime.Composable | ||||||||||||||||||||||||||||||
| import com.ninecraft.booket.core.designsystem.theme.ReedTheme | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| enum class ReedButtonColorStyle { | ||||||||||||||||||||||||||||||
| PRIMARY, SECONDARY, TERTIARY; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||
| fun containerColor(isPressed: Boolean) = when (this) { | ||||||||||||||||||||||||||||||
| PRIMARY -> if (isPressed) ReedTheme.colors.bgPrimaryPressed else ReedTheme.colors.bgPrimary | ||||||||||||||||||||||||||||||
| SECONDARY -> if (isPressed) ReedTheme.colors.bgSecondaryPressed else ReedTheme.colors.bgSecondary | ||||||||||||||||||||||||||||||
| TERTIARY -> if (isPressed) ReedTheme.colors.bgTertiaryPressed else ReedTheme.colors.bgTertiary | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion KAKAO 스타일의 pressed 상태 처리를 확인해주세요. KAKAO 스타일의 경우 - KAKAO -> Kakao
+ KAKAO -> if (isPressed) /* pressed 상태 색상 */ else Kakao📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 디자이너가 따로 pressed 컬러 정의를 안해줬어 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seoyoon513 이해했습니다! 디자이너가 KAKAO 스타일에 대해 pressed 상태 색상을 별도로 정의하지 않았다면, 현재 구현이 올바르네요. 디자인 시스템에서는 모든 인터랙션 상태에 대해 항상 별도의 시각적 피드백이 필요한 것은 아니죠. 현재 구현대로 KAKAO 스타일은 pressed 상태에서도 동일한 색상을 유지하는 것이 디자인 의도에 맞습니다. 🐰 ✏️ Learnings added
🧠 Learnings used |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||
| fun contentColor() = when (this) { | ||||||||||||||||||||||||||||||
| PRIMARY -> ReedTheme.colors.contentInverse | ||||||||||||||||||||||||||||||
| SECONDARY -> ReedTheme.colors.contentPrimary | ||||||||||||||||||||||||||||||
| TERTIARY -> ReedTheme.colors.contentBrand | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||
| fun disabledContainerColor() = ReedTheme.colors.bgDisabled | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||
| fun disabledContentColor() = ReedTheme.colors.contentDisabled | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.ninecraft.booket.core.designsystem.component.button | ||
|
|
||
| import androidx.compose.foundation.layout.PaddingValues | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.text.TextStyle | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
| import com.ninecraft.booket.core.designsystem.theme.ReedTheme | ||
|
|
||
| data class ButtonSizeStyle( | ||
| val paddingValues: PaddingValues, | ||
| val radius: Dp = 0.dp, | ||
| val textStyle: TextStyle, | ||
| val iconSpacing: Dp = 0.dp, | ||
| ) | ||
|
|
||
| val largeButtonStyle: ButtonSizeStyle | ||
| @Composable get() = ButtonSizeStyle( | ||
| paddingValues = PaddingValues( | ||
| horizontal = ReedTheme.spacing.spacing5, | ||
| vertical = ReedTheme.spacing.spacing3, | ||
| ), | ||
| radius = ReedTheme.radius.sm, | ||
| textStyle = ReedTheme.typography.body1Medium, | ||
| iconSpacing = ReedTheme.spacing.spacing2, | ||
| ) | ||
|
|
||
| val mediumButtonStyle: ButtonSizeStyle | ||
| @Composable get() = ButtonSizeStyle( | ||
| paddingValues = PaddingValues( | ||
| horizontal = ReedTheme.spacing.spacing4, | ||
| vertical = ReedTheme.spacing.spacing3, | ||
| ), | ||
| radius = ReedTheme.radius.sm, | ||
| textStyle = ReedTheme.typography.label1Medium, | ||
| iconSpacing = ReedTheme.spacing.spacing1, | ||
| ) | ||
|
|
||
| val smallButtonStyle: ButtonSizeStyle | ||
| @Composable get() = ButtonSizeStyle( | ||
| paddingValues = PaddingValues( | ||
| horizontal = ReedTheme.spacing.spacing3, | ||
| vertical = ReedTheme.spacing.spacing2, | ||
| ), | ||
| radius = ReedTheme.radius.xs, | ||
| textStyle = ReedTheme.typography.label1Medium, | ||
| iconSpacing = ReedTheme.spacing.spacing1, | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.