-
Notifications
You must be signed in to change notification settings - Fork 3
[UI] view appbar header modal 컴포넌트 구현 #21
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 all commits
2089349
d52c6ef
8a019d2
62ba3c9
ee54e24
3d5c7fb
84f4d16
23a6ef3
3b0c5db
9a1f311
eb59fe6
0ae1f13
e23fae0
da02294
bbc94c4
b6dd6f2
59a4b9e
b008dc8
762faff
4bcd204
7679dea
b8a06fb
ced67ef
ab596f4
cb68f34
53061b2
c653ce7
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.
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,31 @@ | ||
| package com.texthip.thip | ||
|
|
||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material3.Scaffold | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.navigation.compose.currentBackStackEntryAsState | ||
| import androidx.navigation.compose.rememberNavController | ||
| import com.texthip.thip.ui.navigator.BottomNavigationBar | ||
| import com.texthip.thip.ui.navigator.MainNavHost | ||
| import com.texthip.thip.ui.navigator.NavBarItems | ||
|
|
||
| @Composable | ||
| fun MainScreen() { | ||
| val navController = rememberNavController() | ||
| val navBackStackEntry by navController.currentBackStackEntryAsState() | ||
| val currentRoute = navBackStackEntry?.destination?.route | ||
| val showBottomBar = currentRoute in NavBarItems.BarItems.map { it.route } | ||
|
|
||
| Scaffold( | ||
| bottomBar = { | ||
| if (showBottomBar) BottomNavigationBar(navController) | ||
| } | ||
| ) { innerPadding -> | ||
| Box(modifier = Modifier.padding(innerPadding)) { | ||
| MainNavHost (navController) | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.texthip.thip.ui.bookSearch.screen | ||
|
|
||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.navigation.NavController | ||
|
|
||
| @Composable | ||
| fun BookSearchScreen(navController: NavController) { | ||
| Box( | ||
| modifier = Modifier.fillMaxSize(), | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| Text(text = "Book Search Screen") | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package com.texthip.thip.ui.common.header | ||
|
|
||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Box | ||
| 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.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material3.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.graphics.painter.Painter | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.texthip.thip.ui.theme.ThipTheme | ||
| import com.texthip.thip.ui.theme.ThipTheme.colors | ||
| import com.texthip.thip.ui.theme.ThipTheme.typography | ||
| import com.texthip.thip.R | ||
| import com.texthip.thip.ui.theme.Grey02 | ||
|
|
||
| @Composable | ||
| fun AuthorHeader( | ||
| modifier: Modifier = Modifier, | ||
| profileImage: Painter?, | ||
| nickname: String, | ||
| badgeText: String, | ||
| onSubscribeClick: () -> Unit | ||
| ) { | ||
| Row( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .padding(horizontal = 20.dp), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| if (profileImage != null) { | ||
| Image( | ||
| painter = profileImage, | ||
| contentDescription = "작성자 장르이미지", | ||
| modifier = Modifier | ||
| .size(48.dp) | ||
| .clip(CircleShape) | ||
| ) | ||
| } else { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(48.dp) | ||
| .clip(CircleShape) | ||
| .background(colors.Grey) | ||
| ) | ||
| } | ||
| Spacer(modifier = Modifier.width(8.dp)) | ||
| Column( | ||
| modifier = Modifier.weight(1f) | ||
| ) { | ||
| Text( | ||
| text = nickname, | ||
| style = typography.smalltitle_sb600_s18_h24, | ||
| color = colors.White, | ||
| maxLines = 1 | ||
| ) | ||
| Text( | ||
| text = badgeText, | ||
| style = typography.feedcopy_r400_s14_h20, | ||
| color = colors.NeonGreen, | ||
| maxLines = 1 | ||
| ) | ||
| } | ||
|
|
||
| Box( | ||
| modifier = Modifier | ||
| .clip(RoundedCornerShape(20.dp)) | ||
| .border(1.dp, Grey02, RoundedCornerShape(20.dp)) | ||
| .background(Color.Transparent) | ||
| .clickable { onSubscribeClick() } | ||
| .padding(horizontal = 12.dp, vertical = 8.dp) | ||
| ) { | ||
| Text( | ||
| text = stringResource(R.string.subscribe), | ||
| style = typography.menu_m500_s14_h24, | ||
| color = colors.White | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun PreviewAuthorHeader() { | ||
| ThipTheme { | ||
| AuthorHeader( | ||
| profileImage = null, | ||
| nickname = "열자자제한열열자제한", | ||
| badgeText = "칭호칭호칭호", | ||
| onSubscribeClick = { println("구독") } | ||
| ) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| package com.texthip.thip.ui.common.header | ||
|
|
||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Box | ||
| 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.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.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.graphics.ColorFilter | ||
| import androidx.compose.ui.graphics.painter.Painter | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.texthip.thip.R | ||
| import com.texthip.thip.ui.theme.Grey | ||
| 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 ProfileBar( | ||
| modifier: Modifier = Modifier, | ||
| profileImage: Painter?, | ||
| topText: String, | ||
| bottomText: String, | ||
| showSubscriberInfo: Boolean, | ||
| subscriberCount: Int = 0, | ||
| hoursAgo: Int = 0 | ||
| ) { | ||
| Row( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .padding(horizontal = 16.dp, vertical = 12.dp), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| if (profileImage != null) { | ||
| Image( | ||
| painter = profileImage, | ||
| contentDescription = "프로필 이미지", | ||
| modifier = Modifier | ||
| .size(36.dp) | ||
| .clip(CircleShape) | ||
| ) | ||
| } else { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(36.dp) | ||
| .clip(CircleShape) | ||
| .background(Grey) | ||
| ) | ||
| } | ||
| Spacer(modifier = Modifier.width(8.dp)) | ||
| Column(modifier = Modifier.weight(1f)) { | ||
| Text( | ||
| text = topText, | ||
| style = typography.view_m500_s14, | ||
| color = colors.White | ||
| ) | ||
| Text( | ||
| text = bottomText, | ||
| style = typography.info_r400_s12, | ||
| color = colors.NeonGreen | ||
| ) | ||
| } | ||
| if (showSubscriberInfo) { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Text( | ||
| text = stringResource(R.string.subscriber_num,subscriberCount), | ||
| style = typography.timedate_r400_s11, | ||
| color = colors.Grey01 | ||
| ) | ||
| Spacer(modifier = Modifier.width(4.dp)) | ||
| Icon( | ||
| painter = painterResource(id = R.drawable.ic_chevron_right), | ||
| contentDescription = "화살표", | ||
| modifier = Modifier.size(16.dp), | ||
| tint = Color.Unspecified | ||
| ) | ||
| } | ||
| } else { | ||
| Text( | ||
| text = stringResource(R.string.hours_ago,hoursAgo), | ||
| style = typography.timedate_r400_s11, | ||
| color = colors.Grey01 | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| @Preview(showBackground = true) | ||
| fun PreviewProfileBar() { | ||
| ThipTheme { | ||
| Column { | ||
| ProfileBar( | ||
| profileImage = null, | ||
| topText = "user.01", | ||
| bottomText = stringResource(R.string.influencer), | ||
| showSubscriberInfo = true, | ||
| subscriberCount = 77 | ||
| ) | ||
| ProfileBar( | ||
| profileImage = null, | ||
| topText = "user.04", | ||
| bottomText = stringResource(R.string.influencer), | ||
| showSubscriberInfo = false, | ||
| hoursAgo = 7 | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
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.
🛠️ Refactor suggestion
테마 색상 일관성 유지
플레이스홀더 배경색으로
Grey를 사용하고 있지만, 다른 부분에서는colors.Grey01을 사용하고 있습니다. 테마 일관성을 위해 theme colors를 사용하는 것이 좋습니다.🤖 Prompt for AI Agents