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

[UI/#29] post bottom bar #31

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,102 @@
package com.sopt.withsuhyeon.core.component.bottombar

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sopt.withsuhyeon.R
import com.sopt.withsuhyeon.core.component.button.LargeButton
import com.sopt.withsuhyeon.core.util.price.toDecimalFormat
import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors
import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography

@Composable
fun PostBottomBar(
price: Int,
isMyPost: Boolean,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isMyPost ์ฒ˜๋ฆฌ๊นŒ์ง€ ๊ตฟ !!

isDisabled: Boolean = true,
modifier: Modifier = Modifier,
onClick: () -> Unit = {}
) {
val borderColor = colors.Grey100
val buttonText = if(isMyPost)
stringResource(R.string.post_bottom_bar_in_progress_chating)
else
stringResource(R.string.post_bottom_bar_start_chating)

Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterHorizontally),
modifier = modifier
.fillMaxWidth()
.height(106.dp)
.drawBehind {
val borderThickness = 1.dp.toPx()
drawLine(
color = borderColor,
start = Offset(0f, 0f),
end = Offset(size.width, 0f),
strokeWidth = borderThickness
)
}
.background(
color = colors.White,
)
.padding(
top = 16.dp,
bottom = 34.dp,
start = 16.dp,
end = 16.dp
)
) {
Column(
) {
Text(
text = stringResource(R.string.find_suhyeon_price),
style = typography.caption01_SB.merge(colors.Grey500)
)
Text(
text = price.toDecimalFormat(),
style = typography.body02_B.merge(colors.Grey900)
)
}
LargeButton(
text = buttonText,
isDisabled = if(isMyPost) false else isDisabled,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

isDownloadBtn = false,
modifier = modifier.weight(1f),
font = typography.body01_B,
onClick = onClick
)
}
}

@Preview
@Composable
fun PreviewPostBottomBar() {
var isDisabled by remember { mutableStateOf(false) }
PostBottomBar(
price = 50000,
isMyPost = false,
isDisabled = isDisabled,
onClick = {
isDisabled = !isDisabled
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fun DetailMeetingInformation (
modifier = Modifier.fillMaxWidth()
) {
Text(
text = stringResource(R.string.find_suhyeon_detail_meeting_price),
text = stringResource(R.string.find_suhyeon_price),
style = typography.body03_R.merge(color = colors.Grey500)
)
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ fun MainBottomBar(
enter = fadeIn() + slideIn { IntOffset(0, it.height) },
exit = fadeOut() + slideOut { IntOffset(0, it.height) }
) {
val borderColor = defaultWithSuhyeonColors.Grey200
Row(
modifier = modifier
.fillMaxWidth()
.height(68.dp)
.drawBehind {
val borderColor = defaultWithSuhyeonColors.Grey200
val borderThickness = 1.dp.toPx()

drawLine(
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@
<string name="find_suhyeon_detail_meeting_wanted">์›ํ•˜๋Š” ์ˆ˜ํ˜„์ด</string>
<string name="find_suhyeon_detail_meeting_date">๋‚ ์งœ</string>
<string name="find_suhyeon_detail_meeting_requirements">์š”๊ตฌ์‚ฌํ•ญ</string>
<string name="find_suhyeon_detail_meeting_price">๊ธˆ์•ก</string>
<string name="find_suhyeon_price">๊ธˆ์•ก</string>
<string name="find_suhyeon_text_won">์›</string>
<string name="find_suhyeon_no_message"></string>
<string name="find_suhyeon_location">์œ„์น˜</string>
<string name="find_suhyeon_multi_select_chip">MultiSelectChip</string>

<!-- ๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ PostBottomBar -->
<string name="post_bottom_bar_start_chating">์ฑ„ํŒ…ํ•˜๊ธฐ</string>
<string name="post_bottom_bar_in_progress_chating">๋Œ€ํ™” ์ค‘์ธ ์ฑ„ํŒ…</string>

<!-- ๊ณตํ†ต ์‚ฌ์šฉ dot -->
<string name="dot">ใƒป</string>

Expand Down