Skip to content

Commit 796487c

Browse files
committed
[ui]: Feed - 내 구독 리스트 (구독취소시 구독으로 텍스트 변경되는 버전으로)(#37)
1 parent 36fb4ea commit 796487c

7 files changed

Lines changed: 365 additions & 14 deletions

File tree

app/src/main/java/com/texthip/thip/ui/common/header/AuthorHeader.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Column
99
import androidx.compose.foundation.layout.Row
1010
import androidx.compose.foundation.layout.Spacer
1111
import androidx.compose.foundation.layout.fillMaxWidth
12+
import androidx.compose.foundation.layout.height
1213
import androidx.compose.foundation.layout.padding
1314
import androidx.compose.foundation.layout.size
1415
import androidx.compose.foundation.layout.width
@@ -23,6 +24,7 @@ import androidx.compose.ui.graphics.Color
2324
import androidx.compose.ui.graphics.painter.Painter
2425
import androidx.compose.ui.res.stringResource
2526
import androidx.compose.ui.tooling.preview.Preview
27+
import androidx.compose.ui.unit.Dp
2628
import androidx.compose.ui.unit.dp
2729
import com.texthip.thip.ui.theme.ThipTheme
2830
import com.texthip.thip.ui.theme.ThipTheme.colors
@@ -38,6 +40,7 @@ fun AuthorHeader(
3840
nickname: String,
3941
badgeText: String,
4042
buttonText: String,
43+
buttonWidth: Dp? = null,
4144
onButtonClick: () -> Unit = {}
4245
) {
4346
Row(
@@ -81,9 +84,15 @@ fun AuthorHeader(
8184
}
8285
OutlinedButton(
8386
modifier = Modifier
84-
.size(width = 51.dp, height = 35.dp),
87+
.then(
88+
if (buttonWidth != null)
89+
Modifier
90+
.width(buttonWidth)
91+
.height(33.dp)
92+
else Modifier
93+
),
8594
text = buttonText,
86-
textStyle = typography.menu_m500_s14_h24,
95+
textStyle = typography.view_m500_s14,
8796
onClick = onButtonClick
8897
)
8998
}
@@ -97,7 +106,8 @@ fun PreviewAuthorHeader() {
97106
profileImage = null,
98107
nickname = "열자자제한열열자제한",
99108
badgeText = "칭호칭호칭호",
100-
buttonText = "구독"
109+
buttonText = "구독",
110+
buttonWidth = 60.dp
101111
)
102112
}
103113
}

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.texthip.thip.ui.theme.ThipTheme.typography
2525
fun ToastWithDate(
2626
modifier: Modifier = Modifier,
2727
message: String,
28-
date: String
28+
date: String? = null
2929
) {
3030
Box(
3131
modifier = modifier
@@ -41,18 +41,20 @@ fun ToastWithDate(
4141
Row(
4242
modifier = Modifier.fillMaxWidth(),
4343
verticalAlignment = Alignment.CenterVertically,
44-
horizontalArrangement = Arrangement.SpaceBetween
44+
horizontalArrangement = if (date != null) Arrangement.SpaceBetween else Arrangement.Start
4545
) {
4646
Text(
4747
text = message,
4848
color = colors.White,
4949
style = typography.view_m500_s12_h20
5050
)
51-
Text(
52-
text = date,
53-
color = colors.Grey02,
54-
style = typography.timedate_r400_s11
55-
)
51+
if (date != null) {
52+
Text(
53+
text = date,
54+
color = colors.Grey02,
55+
style = typography.timedate_r400_s11
56+
)
57+
}
5658
}
5759
}
5860
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package com.texthip.thip.ui.feed.component
2+
3+
import androidx.compose.foundation.layout.Arrangement
4+
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.fillMaxWidth
6+
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.material3.HorizontalDivider
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Modifier
10+
import androidx.compose.ui.res.stringResource
11+
import androidx.compose.ui.tooling.preview.Preview
12+
import androidx.compose.ui.unit.dp
13+
import com.texthip.thip.R
14+
import com.texthip.thip.ui.common.header.AuthorHeader
15+
import com.texthip.thip.ui.feed.mock.MySubscriptionData
16+
import com.texthip.thip.ui.theme.ThipTheme.colors
17+
18+
@Composable
19+
fun MySubscriptionList(
20+
members: List<MySubscriptionData>,
21+
onUnsubscribe: (String) -> Unit
22+
) {
23+
Column(
24+
verticalArrangement = Arrangement.spacedBy(16.dp),
25+
modifier = Modifier
26+
.fillMaxWidth()
27+
.padding(vertical = 20.dp)
28+
) {
29+
members.forEachIndexed { index, member ->
30+
AuthorHeader(
31+
profileImage = member.profileImageUrl,
32+
nickname = member.nickname,
33+
badgeText = member.role,
34+
buttonText = stringResource(if(member.isSubscribed) R.string.subscribe_cancel else R.string.subscribe),
35+
buttonWidth = 73.dp,
36+
onButtonClick = {
37+
onUnsubscribe(member.nickname)
38+
}
39+
)
40+
41+
if (index != members.lastIndex) {
42+
HorizontalDivider(
43+
color = colors.DarkGrey02,
44+
thickness = 1.dp
45+
)
46+
}
47+
}
48+
}
49+
}
50+
51+
@Preview
52+
@Composable
53+
private fun MySubscriptionListPrev() {
54+
MySubscriptionList(
55+
members = listOf(
56+
MySubscriptionData(
57+
profileImageUrl = null,
58+
nickname = "Thiper",
59+
role = "칭호칭호",
60+
roleColor = colors.Yellow,
61+
subscriberCount = 100,
62+
),
63+
MySubscriptionData(
64+
profileImageUrl = null,
65+
nickname = "thipthip",
66+
role = "공식 인플루언서",
67+
roleColor = colors.NeonGreen,
68+
subscriberCount = 50
69+
),
70+
MySubscriptionData(
71+
profileImageUrl = null,
72+
nickname = "Thiper",
73+
role = "칭호칭호",
74+
roleColor = colors.Yellow,
75+
subscriberCount = 100
76+
),
77+
MySubscriptionData(
78+
profileImageUrl = null,
79+
nickname = "thip01",
80+
role = "작가",
81+
roleColor = colors.NeonGreen,
82+
subscriberCount = 100
83+
),
84+
),
85+
onUnsubscribe = {}
86+
)
87+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.texthip.thip.ui.feed.mock
2+
3+
import androidx.compose.ui.graphics.Color
4+
import androidx.compose.ui.graphics.painter.Painter
5+
6+
data class MySubscriptionData(
7+
val profileImageUrl: Painter? = null,
8+
val nickname: String,
9+
val role: String,
10+
val roleColor: Color,
11+
val subscriberCount: Int,
12+
var isSubscribed: Boolean = true
13+
)
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
11
package com.texthip.thip.ui.feed.screen
22

3+
import androidx.compose.foundation.background
34
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.Column
46
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.foundation.layout.padding
58
import androidx.compose.material3.Text
69
import androidx.compose.runtime.Composable
710
import androidx.compose.ui.Alignment
811
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.res.painterResource
13+
import androidx.compose.ui.res.stringResource
14+
import androidx.compose.ui.unit.dp
915
import androidx.navigation.NavController
16+
import com.texthip.thip.R
17+
import com.texthip.thip.ui.common.topappbar.LeftNameTopAppBar
18+
import com.texthip.thip.ui.common.topappbar.LogoTopAppBar
19+
import com.texthip.thip.ui.theme.ThipTheme.colors
1020

1121
@Composable
1222
fun FeedScreen(navController: NavController) {
13-
Box(
14-
modifier = Modifier.fillMaxSize(),
15-
contentAlignment = Alignment.Center
23+
Column(
24+
Modifier
25+
.background(colors.Black)
26+
.fillMaxSize()
1627
) {
17-
Text(text = "Feed Screen")
28+
LogoTopAppBar(
29+
leftIcon = painterResource(R.drawable.ic_plusfriend),
30+
hasNotification = true,
31+
onLeftClick = {},
32+
onRightClick = {}
33+
)
34+
Column(
35+
modifier = Modifier
36+
.padding(horizontal = 20.dp)
37+
.fillMaxSize()
38+
) {
39+
40+
}
1841
}
1942
}

0 commit comments

Comments
 (0)