-
Notifications
You must be signed in to change notification settings - Fork 3
[UI] 피드 페이지 구현 #52
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] 피드 페이지 구현 #52
Changes from all commits
d8e0220
108c38c
f5c57f4
839d2fd
5a5109f
f8b330d
365b1e2
4c6a07f
b88d1b2
9c53c60
e8f945b
bd412ab
ddfe631
c100d85
894f0db
29d5fc4
23c0314
38dfa10
8955792
dbc7a69
ca8c947
5747691
3ddcdce
9c0496a
346446c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package com.texthip.thip.ui.common.buttons | ||
|
|
||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.FlowRow | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.mutableStateListOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.texthip.thip.ui.theme.ThipTheme | ||
|
|
||
| @Composable | ||
| fun SubGenreChipGrid( | ||
| subGenres: List<String>, | ||
| selectedGenres: List<String>, | ||
| onGenreToggle: (String) -> Unit | ||
| ) { | ||
| FlowRow( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
| verticalArrangement = Arrangement.spacedBy(8.dp) | ||
| ) { | ||
| subGenres.forEach { genre -> | ||
| OptionChipButton( | ||
| text = genre, | ||
| isSelected = selectedGenres.contains(genre), | ||
| isFilled = false, | ||
| onClick = { onGenreToggle(genre) } | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun PreviewSubGenreChipGrid() { | ||
| ThipTheme { | ||
| val previewSubGenres = listOf( | ||
| "태그1", "태그2", "태그3", "태그4", "태그5", | ||
| "태그6", "태그7", "태그8", "태그9", "태그10" | ||
| ) | ||
| val selectedGenres = remember { mutableStateListOf<String>() } | ||
|
|
||
| SubGenreChipGrid( | ||
| subGenres = previewSubGenres, | ||
| selectedGenres = selectedGenres, | ||
| onGenreToggle = { genre -> | ||
| if (selectedGenres.contains(genre)) { | ||
| selectedGenres.remove(genre) | ||
| } else { | ||
| selectedGenres.add(genre) | ||
| } | ||
| } | ||
| ) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| package com.texthip.thip.ui.feed.component | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.material.Icon | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.text.SpanStyle | ||
| import androidx.compose.ui.text.buildAnnotatedString | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.text.withStyle | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import coil.compose.AsyncImage | ||
| import com.texthip.thip.R | ||
| import com.texthip.thip.ui.theme.ThipTheme | ||
| import com.texthip.thip.ui.theme.ThipTheme.colors | ||
| import com.texthip.thip.ui.theme.ThipTheme.typography | ||
|
|
||
| @Composable | ||
| fun FeedSubscribeBarlist( | ||
| modifier: Modifier = Modifier, | ||
| followerProfileImageUrls: List<String>, | ||
| onClick: () -> Unit | ||
| ) { | ||
| Row( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .height(24.dp) | ||
| .clickable { onClick() }, | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(id = R.drawable.ic_group), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| Text( | ||
| text = buildAnnotatedString { | ||
|
Collaborator
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. 이 코드는 처음 보는데 혹시 어떤 역할을 하는걸까요/
Member
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. 텍스트 내부에 서로 다른 스타일을 적용시키기 위한 함수입니당 |
||
| withStyle( | ||
| style = SpanStyle( | ||
| fontWeight = FontWeight.Bold, | ||
| color = colors.White | ||
| ) | ||
| ) { | ||
| append("${followerProfileImageUrls.size}명") | ||
| } | ||
| withStyle( | ||
| style = SpanStyle( | ||
| color = colors.Grey | ||
| ) | ||
| ) { | ||
| append("이 띱 하는중") | ||
| } | ||
| }, | ||
| style = typography.info_r400_s12, | ||
| modifier = Modifier.padding(start = 2.dp) | ||
| ) | ||
| Spacer(modifier = Modifier.weight(1f)) | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| followerProfileImageUrls.take(5).reversed().forEachIndexed { index, imageUrl -> | ||
| AsyncImage( | ||
| model = imageUrl, | ||
| contentDescription = null, | ||
| modifier = Modifier | ||
| .size(24.dp) | ||
| .clip(CircleShape) | ||
| .background(Color.LightGray) | ||
| ) | ||
|
|
||
| val isLast = index == followerProfileImageUrls.take(5).lastIndex | ||
| Spacer(modifier = Modifier.width(if (isLast) 15.dp else 4.dp)) | ||
| } | ||
|
|
||
| Icon( | ||
| painter = painterResource(id = R.drawable.ic_chevron), | ||
| contentDescription = null, | ||
| tint = colors.Grey | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun FeedSubscribelistBarPreview() { | ||
| ThipTheme { | ||
| Column { | ||
| // Case 1: 팔로워 0 | ||
| FeedSubscribeBarlist( | ||
| followerProfileImageUrls = emptyList(), | ||
| onClick = {} | ||
| ) | ||
|
|
||
| // Case 2: 팔로워 3 | ||
| FeedSubscribeBarlist( | ||
| followerProfileImageUrls = listOf( | ||
| "https://example.com/image1.jpg", | ||
| "https://example.com/image2.jpg", | ||
| "https://example.com/image3.jpg" | ||
| ), | ||
| onClick = {} | ||
| ) | ||
|
|
||
| // Case 3: 팔로워 6 | ||
| FeedSubscribeBarlist( | ||
| followerProfileImageUrls = List(6) { | ||
| "https://example.com/profile$it.jpg" | ||
| }, | ||
| onClick = {} | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| } | ||
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.
modifier 매개변수가 사용되지 않고 있습니다.
modifier매개변수가 추가되었지만 실제로 컴포저블 내에서 사용되지 않고 있습니다. 이로 인해 호출자가 컴포넌트의 모양이나 동작을 수정할 수 없습니다.다음과 같이 수정하여 modifier를 적용해주세요:
Also applies to: 38-43
🤖 Prompt for AI Agents