Skip to content

Commit 8d24e65

Browse files
committed
[chore]: 기존 컴포넌트를 재활용 가능하게 수정 (#47)
1 parent 4c414ae commit 8d24e65

2 files changed

Lines changed: 67 additions & 29 deletions

File tree

app/src/main/java/com/texthip/thip/ui/common/buttons/ActionMediumButton.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fun ActionMediumButton(
3737
contentColor: Color,
3838
backgroundColor: Color,
3939
hasRightIcon: Boolean = false,
40+
hasRightPlusIcon: Boolean = false,
4041
modifier: Modifier = Modifier,
4142
onClick: () -> Unit = {},
4243
) {
@@ -70,7 +71,7 @@ fun ActionMediumButton(
7071

7172
if (hasRightIcon) {
7273
Icon(
73-
painter = painterResource(R.drawable.ic_chevron),
74+
painter = if (hasRightPlusIcon) painterResource(R.drawable.ic_plus) else painterResource(R.drawable.ic_chevron),
7475
contentDescription = null,
7576
tint = contentColor,
7677
)

app/src/main/java/com/texthip/thip/ui/common/modal/InfoPopup.kt

Lines changed: 65 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
package com.texthip.thip.ui.common.modal
22

33
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.border
5+
import androidx.compose.foundation.clickable
46
import androidx.compose.foundation.layout.Box
57
import androidx.compose.foundation.layout.Column
68
import androidx.compose.foundation.layout.Row
79
import androidx.compose.foundation.layout.Spacer
810
import androidx.compose.foundation.layout.fillMaxWidth
911
import androidx.compose.foundation.layout.height
1012
import androidx.compose.foundation.layout.padding
13+
import androidx.compose.foundation.layout.size
1114
import androidx.compose.foundation.rememberScrollState
1215
import androidx.compose.foundation.shape.RoundedCornerShape
1316
import androidx.compose.foundation.verticalScroll
17+
import androidx.compose.material3.Icon
1418
import androidx.compose.material3.Text
1519
import androidx.compose.runtime.Composable
1620
import androidx.compose.ui.Alignment
1721
import androidx.compose.ui.Modifier
22+
import androidx.compose.ui.graphics.Color
23+
import androidx.compose.ui.res.painterResource
1824
import androidx.compose.ui.res.stringResource
1925
import androidx.compose.ui.tooling.preview.Preview
2026
import androidx.compose.ui.unit.dp
@@ -31,42 +37,73 @@ fun InfoPopup(
3137
) {
3238
val scrollState = rememberScrollState()
3339

34-
Box(
35-
modifier = modifier
36-
.fillMaxWidth()
37-
.background(colors.DarkGrey, shape = RoundedCornerShape(12.dp))
38-
.padding(20.dp)
40+
Column(
41+
horizontalAlignment = Alignment.CenterHorizontally,
42+
modifier = Modifier.background(Color.Transparent)
3943
) {
40-
Column {
41-
Row(
42-
verticalAlignment = Alignment.CenterVertically,
43-
modifier = Modifier.fillMaxWidth()
44+
Box(
45+
modifier = modifier
46+
.fillMaxWidth()
47+
.background(colors.DarkGrey, shape = RoundedCornerShape(12.dp))
48+
.padding(20.dp)
49+
) {
50+
Column(
51+
horizontalAlignment = Alignment.CenterHorizontally
4452
) {
45-
Text(
46-
text = title,
47-
color = colors.White,
48-
style = typography.smalltitle_sb600_s16_h24
49-
)
53+
Row(
54+
verticalAlignment = Alignment.CenterVertically,
55+
modifier = Modifier.fillMaxWidth()
56+
) {
57+
Text(
58+
text = title,
59+
color = colors.White,
60+
style = typography.smalltitle_sb600_s16_h24
61+
)
62+
}
63+
Spacer(modifier = Modifier.height(12.dp))
64+
Box(
65+
modifier = Modifier
66+
.fillMaxWidth()
67+
.height(284.dp)
68+
.verticalScroll(scrollState)
69+
.drawVerticalScrollbar(scrollState)
70+
) {
71+
Text(
72+
modifier = Modifier.padding(end = 8.dp),
73+
text = content,
74+
color = colors.White,
75+
style = typography.copy_r400_s12_h20
76+
)
77+
}
5078
}
51-
Spacer(modifier = Modifier.height(12.dp))
52-
Box(
53-
modifier = Modifier
54-
.fillMaxWidth()
55-
.height(284.dp)
56-
.verticalScroll(scrollState)
57-
.drawVerticalScrollbar(scrollState)
58-
) {
59-
Text(
60-
text = content,
61-
color = colors.White,
62-
style = typography.copy_r400_s12_h20
79+
}
80+
81+
// 아래쪽 X버튼 (원형)
82+
Box(
83+
modifier = Modifier
84+
.padding(top = 20.dp)
85+
.size(50.dp)
86+
.background(Color.Transparent, shape = RoundedCornerShape(24.dp))
87+
.border(
88+
width = 2.dp,
89+
color = colors.Grey02,
90+
shape = RoundedCornerShape(24.dp)
6391
)
64-
}
92+
.clickable { onDismiss() },
93+
contentAlignment = Alignment.Center
94+
) {
95+
Icon(
96+
painter = painterResource(R.drawable.ic_x_20),
97+
contentDescription = "닫기",
98+
tint = colors.White,
99+
modifier = Modifier.size(24.dp)
100+
)
65101
}
66102
}
67103
}
68104

69-
@Preview(showBackground = true)
105+
106+
@Preview()
70107
@Composable
71108
fun PreviewInfoPopup() {
72109
val dummyText = """

0 commit comments

Comments
 (0)