-
Notifications
You must be signed in to change notification settings - Fork 1
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
[UI/#53] TerningBasicDialog #61
Changes from 10 commits
e9a360f
24a8a79
21b6e7f
4dc84b8
8539876
3681836
1902f26
967aa92
6bac3ba
45e3c59
d2c0fdd
95deceb
b37203d
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,240 @@ | ||
package com.terning.core.designsystem.component.dialog | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
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.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.R | ||
import com.terning.core.designsystem.component.button.RoundButton | ||
import com.terning.core.designsystem.theme.CalGreen2 | ||
import com.terning.core.designsystem.theme.Grey200 | ||
import com.terning.core.designsystem.theme.Grey300 | ||
import com.terning.core.designsystem.theme.Grey350 | ||
import com.terning.core.designsystem.theme.Grey500 | ||
import com.terning.core.designsystem.theme.TerningMain | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.core.designsystem.theme.White | ||
import com.terning.core.extension.noRippleClickable | ||
|
||
|
||
@Composable | ||
fun ScrapDialogContent( | ||
onDismissRequest: () -> Unit, | ||
isScrapped: Boolean, | ||
) { | ||
var isColorChange by remember { mutableStateOf(false) } | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.wrapContentHeight() | ||
.padding(30.dp) | ||
.background( | ||
color = White, | ||
shape = RoundedCornerShape(20.dp) | ||
), | ||
) { | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.End | ||
) { | ||
IconButton(onClick = { onDismissRequest() }, modifier = Modifier.padding(6.dp)) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_dialog_x_32), | ||
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. 줄바꿈!! 해주세요!! 그리구 여기가 X 버튼인 것 같은데 noRippleClickable로 해줘야 할 것 같아요!! 컴포즈는 기본으로 ripple 효과가 들어가기 때문에 요 부분 신경써준다면 감사하겠습니당 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. 넵 적용해씁니다!!! |
||
contentDescription = null, | ||
tint = Grey300 | ||
) | ||
} | ||
} | ||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(top = 32.dp), | ||
contentAlignment = Alignment.TopCenter | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 11.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Row( | ||
modifier = Modifier | ||
.width(60.dp) | ||
.height(60.dp) | ||
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. aspectRatio 사용해도 좋을 것 같아요! |
||
.border( | ||
width = 1.dp, | ||
color = TerningMain, | ||
shape = RoundedCornerShape(size = 15.dp) | ||
) | ||
) { | ||
Image( | ||
painter = painterResource( | ||
id = R.drawable.ic_character1 | ||
), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.background( | ||
Grey200, | ||
shape = RoundedCornerShape(size = 15.dp) | ||
), | ||
contentDescription = null, | ||
contentScale = ContentScale.Fit, | ||
alignment = Alignment.Center | ||
) | ||
} | ||
Text( | ||
text = "[한양대학교 컬렉티브임팩트센터] /코이카 영프로페셔널(YP) 모집합니다", | ||
textAlign = TextAlign.Center, | ||
style = TerningTheme.typography.title4, | ||
color = Grey500, | ||
modifier = Modifier.padding(top = 20.dp) | ||
) | ||
Text( | ||
text = stringResource(id = R.string.dialog_content_scrap_sub_title), | ||
style = TerningTheme.typography.body5, | ||
color = Grey350, | ||
modifier = Modifier.padding( | ||
top = 4.dp, | ||
bottom = 13.dp | ||
) | ||
) | ||
Column( | ||
horizontalAlignment = Alignment.Start, | ||
verticalArrangement = Arrangement.Top, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 13.dp) | ||
) { | ||
Row( | ||
modifier = Modifier | ||
.background( | ||
color = CalGreen2, | ||
shape = RoundedCornerShape(14.dp) | ||
) | ||
.noRippleClickable { | ||
isColorChange = !isColorChange | ||
}, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.Start | ||
) { | ||
Icon( | ||
painter = painterResource( | ||
id = if (isColorChange) R.drawable.ic_up_22 | ||
else R.drawable.ic_down_22 | ||
), | ||
contentDescription = stringResource( | ||
id = R.string.dialog_content_color_button | ||
), | ||
tint = White, | ||
modifier = Modifier.padding( | ||
start = 7.dp, | ||
top = 2.dp, | ||
bottom = 2.dp | ||
) | ||
) | ||
Text( | ||
text = stringResource(id = R.string.dialog_content_color_button), | ||
style = TerningTheme.typography.body5, | ||
color = White, | ||
modifier = Modifier.padding(end = 13.dp) | ||
) | ||
} | ||
HorizontalDivider( | ||
thickness = 1.dp, | ||
color = Grey200, | ||
modifier = Modifier.padding( | ||
top = 11.dp, | ||
bottom = 8.dp | ||
) | ||
) | ||
if (isColorChange) { | ||
Text(text = "컬러 팔레트") | ||
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. 추출해주세요!!! |
||
} else { | ||
Text( | ||
text = stringResource(id = R.string.intern_item_d_day), | ||
style = TerningTheme.typography.body5, | ||
color = TerningMain, | ||
modifier = Modifier.padding(bottom = 9.dp) | ||
) | ||
Column( | ||
modifier = Modifier.padding(bottom = 29.dp), | ||
verticalArrangement = Arrangement.spacedBy( | ||
5.dp, | ||
Alignment.CenterVertically | ||
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. 와우 Arrangement 안에 Alignment 넣을 수 있는거 처음 알았어요..!! |
||
), | ||
horizontalAlignment = Alignment.Start, | ||
) { | ||
listOf( | ||
stringResource(id = R.string.intern_info_d_day) to "2024년 7월 23일", | ||
stringResource(id = R.string.intern_info_working) to "2개월", | ||
stringResource(id = R.string.intern_info_start_date) to "2024년 8월" | ||
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. 파라미터로 받아오는걸로 수정해야 할 것 같아요!! 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. 아니 진짜 섬세,, ㅠㅠ 고쳤릅니다! |
||
).forEach { (title, value) -> | ||
InternInfoRow(title, value) | ||
} | ||
} | ||
} | ||
} | ||
RoundButton( | ||
style = TerningTheme.typography.button3, | ||
paddingVertical = 12.dp, | ||
cornerRadius = 8.dp, | ||
text = if (isScrapped) { | ||
if (isColorChange) | ||
R.string.dialog_content_color_button | ||
else R.string.dialog_scrap_button | ||
} else { | ||
R.string.dialog_scrap_button | ||
}, | ||
onButtonClick = { /*TODO*/ }, | ||
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. 이렇게 하면 ripple이 생겨서 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. 흠,,근데 제가 noRippleTheme 작성했었는데 적용이 안 되나요,,? 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. 요거는 유빈이가 만들어준거라서 디폴트로 적용되어 이씁니다! |
||
modifier = Modifier.padding(bottom = 8.dp) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// TODO 삭제 | ||
@Composable | ||
fun InternInfoRow(title: String, value: String) { | ||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.Start), | ||
verticalAlignment = Alignment.Top, | ||
) { | ||
Text( | ||
text = title, | ||
style = TerningTheme.typography.body2, | ||
color = Grey350, | ||
) | ||
Text( | ||
text = value, | ||
style = TerningTheme.typography.body3, | ||
color = Grey500, | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.terning.core.designsystem.component.dialog | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.window.Dialog | ||
import androidx.compose.ui.window.DialogProperties | ||
|
||
@Composable | ||
fun TerningBasicDialog( | ||
onDismissRequest: () -> Unit, | ||
properties: DialogProperties = DialogProperties( | ||
usePlatformDefaultWidth = false, | ||
decorFitsSystemWindows = true, | ||
dismissOnBackPress = true, | ||
dismissOnClickOutside = true, | ||
), | ||
content: @Composable () -> Unit, | ||
) { | ||
Dialog( | ||
onDismissRequest = { onDismissRequest() }, | ||
properties = properties, | ||
) { | ||
content() | ||
} | ||
} | ||
|
||
@Preview(showBackground = true, showSystemUi = true) | ||
@Composable | ||
fun TerningBasicDialogPreview() { | ||
TerningBasicDialog( | ||
onDismissRequest = {}, | ||
content = { | ||
ScrapDialogContent( | ||
onDismissRequest = {}, | ||
isScrapped = false | ||
) | ||
} | ||
) | ||
} |
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="32dp" | ||
android:height="32dp" | ||
android:viewportWidth="32" | ||
android:viewportHeight="32"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h32v32h-32z"/> | ||
<path | ||
android:pathData="M9.511,22.247C9.079,21.815 9.089,21.081 9.511,20.66L14.403,15.758L9.511,10.866C9.089,10.444 9.079,9.711 9.511,9.279C9.943,8.847 10.676,8.857 11.098,9.269L16,14.171L20.892,9.279C21.314,8.857 22.047,8.847 22.479,9.279C22.911,9.711 22.901,10.444 22.479,10.866L17.587,15.758L22.479,20.66C22.901,21.081 22.911,21.815 22.479,22.247C22.047,22.679 21.314,22.669 20.892,22.247L16,17.355L11.098,22.247C10.676,22.669 9.943,22.679 9.511,22.247Z" | ||
android:fillColor="#BCBCBC"/> | ||
</group> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="22dp" | ||
android:height="22dp" | ||
android:viewportWidth="22" | ||
android:viewportHeight="22"> | ||
<path | ||
android:pathData="M11.492,14.707C11.102,15.098 10.47,15.098 10.08,14.707L4.865,9.48C4.475,9.089 4.475,8.455 4.865,8.064C5.255,7.673 5.887,7.673 6.278,8.064L10.786,12.583L15.294,8.064C15.684,7.673 16.317,7.673 16.707,8.064C17.097,8.455 17.097,9.089 16.707,9.48L11.492,14.707Z" | ||
android:fillColor="#ffffff" | ||
android:fillType="evenOdd"/> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="22dp" | ||
android:height="22dp" | ||
android:viewportWidth="22" | ||
android:viewportHeight="22"> | ||
<path | ||
android:pathData="M10.508,7.293C10.898,6.902 11.53,6.902 11.92,7.293L17.135,12.52C17.525,12.911 17.525,13.545 17.135,13.936C16.745,14.327 16.113,14.327 15.722,13.936L11.214,9.417L6.706,13.936C6.316,14.327 5.683,14.327 5.293,13.936C4.903,13.545 4.903,12.911 5.293,12.52L10.508,7.293Z" | ||
android:fillColor="#ffffff" | ||
android:fillType="evenOdd"/> | ||
</vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 자동으로 White 설정은 안 되는 건가용,,?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹 머터리얼 기본 보라색,,.?희미한 그 색이 되더라구욧..