Skip to content
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

[YDS-#250] Improve : SearchTopBar 뒤에 TopBarButton 올 수 있게 추가 #251

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -36,22 +37,24 @@ fun SearchTopBar(
onSearch: () -> Unit,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
modifier = modifier
.fillMaxWidth()
.height(56.dp),
contentPadding = PaddingValues(start = 4.dp),
contentPadding = PaddingValues(0.dp)
) {
Box(
modifier = Modifier
.padding(start = 4.dp)
.fillMaxWidth(),
) {
Row(
modifier = Modifier.fillMaxWidth(),
) {
navigationIcon()
Box(modifier = Modifier.padding(start = 4.dp, end = 4.dp)) {
navigationIcon()
}
SearchTextField(
text = text,
placeHolderText = placeHolderText,
Expand All @@ -60,10 +63,12 @@ fun SearchTopBar(
onSearch = onSearch,
interactionSource = interactionSource,
modifier = Modifier
.padding(start = 4.dp, end = 16.dp)
.fillMaxWidth()
.weight(1f)
.align(alignment = CenterVertically),
)
Row(modifier = Modifier.padding(start = 4.dp, end = 4.dp)) {
actions()
}
}
}
}
Expand Down Expand Up @@ -92,19 +97,25 @@ private fun PreviewSearchTopBar() {
Toast.LENGTH_SHORT,
).show()
},
navigationIcon = {
// navigationIcon = {
// TopBarButton(
// icon = R.drawable.ic_arrow_left_line,
// isDisabled = false,
// onClick = {
// Toast.makeText(
// context,
// "navigationIcon Clicked!",
// Toast.LENGTH_SHORT,
// ).show()
// },
// )
// },
actions = {
TopBarButton(
icon = R.drawable.ic_arrow_left_line,
isDisabled = false,
onClick = {
Toast.makeText(
context,
"navigationIcon Clicked!",
Toast.LENGTH_SHORT,
).show()
},
text = "취소",
isDisabled = false
)
},
}
)
},
) {
Expand Down
Loading