Skip to content

Commit

Permalink
[MOD/#22] ChatIScreen ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
jangsjw committed Jan 14, 2025
1 parent a2b1d79 commit a114c81
Showing 1 changed file with 75 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ package com.napzak.market.presentation.chat.screen

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
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.fillMaxSize
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.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
Expand All @@ -15,54 +24,62 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.napzak.market.core.designsystem.theme.NapzakMarketTheme
import com.napzak.market.R
import com.napzak.market.core.common.util.NoRippleInteractionSource
import com.napzak.market.core.designsystem.component.topbar.BackTopBar
import com.napzak.market.presentation.chat.component.ChatInfoSectionBuy
import com.napzak.market.presentation.chat.component.ChatInfoSectionSell
import com.napzak.market.core.designsystem.theme.NapzakMarketTheme
import com.napzak.market.presentation.chat.component.ChatInfoSection
import com.napzak.market.presentation.chat.type.ChatType

/**
* ์ฑ„ํŒ… ํ™”๋ฉด ์ƒ๋‹จ ์ •๋ณด ์„น์…˜ ์ปดํฌ๋„ŒํŠธ.
*
* ์ œ๋ชฉ, ์„ค๋ช…, ๊ฐ€๊ฒฉ ์ •๋ณด๋ฅผ ํ‘œ์‹œํ•˜๋ฉฐ, ํ•„์š” ์‹œ ๊ฐ€๊ฒฉ ๋ ˆ์ด๋ธ”์„ ์ถ”๊ฐ€๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
*
* @param title ์ •๋ณด ์„น์…˜์— ํ‘œ์‹œ๋  ์ œ๋ชฉ
* @param description ์ •๋ณด ์„น์…˜์— ํ‘œ์‹œ๋  ์„ค๋ช…
* @param price ์ •๋ณด ์„น์…˜์— ํ‘œ์‹œ๋  ๊ฐ€๊ฒฉ
* @param modifier ์ปดํฌ๋„ŒํŠธ์— ์ ์šฉํ•  Modifier
* @param priceLabel ๊ฐ€๊ฒฉ ์•ž์— ํ‘œ์‹œ๋  ๋ ˆ์ด๋ธ” (์„ ํƒ ์‚ฌํ•ญ)
* @param titleColor ์ œ๋ชฉ ํ…์ŠคํŠธ์˜ ์ƒ‰์ƒ
*
*/

@Composable
fun ChatScreen(chatType: ChatType) {
NapzakMarketTheme {
Column(
modifier = Modifier
.fillMaxSize()
.background(NapzakMarketTheme.colors.white),
) {
fun ChatScreen(
chatType: ChatType,
title: String,
description: String,
price: String,
) {
Box(modifier = Modifier.fillMaxSize().background(NapzakMarketTheme.colors.white)) {
Column(modifier = Modifier.fillMaxSize()) {
BackTopBar(
title = "๋‚ฉ์ž‘ํ•œ ์™ธ๊ณ„์ธ",
title = title,
onBackClick = {
//TODO: ๋’ค๋กœ๊ฐ€๊ธฐ ์•ก์…˜ ๊ตฌํ˜„ ํ•„์š”
// TODO: ๋’ค๋กœ๊ฐ€๊ธฐ ์•ก์…˜ ๊ตฌํ˜„ ํ•„์š”
},
modifier = Modifier.fillMaxWidth(),
textStyle = NapzakMarketTheme.typography.titleSemi18,
backgroundColor = NapzakMarketTheme.colors.white,
contentColor = NapzakMarketTheme.colors.gray900,
)

when (chatType) {
ChatType.BUY -> {
ChatInfoSectionBuy(
title = "๊ตฌํ•ด์š”",
description = "์–‘์Šคํƒ€ ํ† ๋ชจ์— ํžˆ์š”๋ฆฌ ์ด์ธ ๋ˆ„์ด ํ•จ๊ป˜",
priceLabel = "๊ฐ€๊ฒฉ์ œ์‹œ",
price = "100,000์›๋Œ€",
)
}

ChatType.SELL -> {
ChatInfoSectionSell(
title = "ํŒ”์•„์š”",
description = "๋”ธ๊ธฐ ๋งˆ์ด๋ฉœ๋กœ๋”” ๋งˆ์Šค์ฝ”ํŠธ ์ธํ˜•",
price = "35,000์›",
)
}
}
ChatInfoSection(
title = when (chatType) {
ChatType.BUY -> stringResource(id = R.string.chat_buy_title)
ChatType.SELL -> stringResource(id = R.string.chat_sell_title)
},
description = description,
price = price,
priceLabel = if (chatType == ChatType.BUY) stringResource(id = R.string.chat_price_label) else null,
titleColor = if (chatType == ChatType.BUY) NapzakMarketTheme.colors.gray900 else NapzakMarketTheme.colors.purple30
)

Box(
modifier = Modifier
Expand All @@ -73,11 +90,8 @@ fun ChatScreen(chatType: ChatType) {
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Image(
painter = painterResource(id = R.drawable.img_chat_background),
imageVector = ImageVector.vectorResource(id = R.drawable.img_chat_background),
contentDescription = stringResource(id = R.string.chat_background_image_description),
modifier = Modifier
.width(225.dp)
.aspectRatio(1.0f),
)
}
}
Expand All @@ -95,18 +109,19 @@ fun ChatScreen(chatType: ChatType) {
) {
IconButton(
onClick = {
// TODO: ํŒŒ์ผ ์ฒจ๋ถ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„
// TODO: ํŒŒ์ผ ์ฒจ๋ถ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„
},
modifier = Modifier
.size(40.dp)
.background(
color = NapzakMarketTheme.colors.gray100,
shape = CircleShape,
)
),
interactionSource = NoRippleInteractionSource
) {
Icon(
painter = painterResource(id = R.drawable.ic_add_13),
contentDescription = stringResource(id = R.string.icon_chat_description_file_attach),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_add_13),
contentDescription = stringResource(id = R.string.chat_description_file_attach),
tint = NapzakMarketTheme.colors.gray600,
)
}
Expand Down Expand Up @@ -145,15 +160,24 @@ fun ChatScreen(chatType: ChatType) {
}
}

@Preview(showBackground = true)
@Composable
fun ChatScreenBuyPreview() {
ChatScreen(chatType = ChatType.BUY)
}

@Preview(showBackground = true)
@Composable
fun ChatScreenSellPreview() {
ChatScreen(chatType = ChatType.SELL)
}
@Preview(showBackground = true)
@Composable
fun ChatScreenBuyPreview() {
ChatScreen(
chatType = ChatType.BUY,
title = "๋‚ฉ์ž‘ํ•œ ์™ธ๊ณ„์ธ",
description = "์–‘์Šคํƒ€ ํ† ๋ชจ์— ํžˆ์š”๋ฆฌ ์ด์ธ ๋ˆ„์ด ํ•จ๊ป˜",
price = "100,000์›๋Œ€"
)
}

@Preview(showBackground = true)
@Composable
fun ChatScreenSellPreview() {
ChatScreen(
chatType = ChatType.SELL,
title = "๋‚ฉ์ž‘ํ•œ ์™ธ๊ณ„์ธ",
description = "๋”ธ๊ธฐ ๋งˆ์ด๋ฉœ๋กœ๋”” ๋งˆ์Šค์ฝ”ํŠธ ์ธํ˜•",
price = "35,000์›"
)
}

0 comments on commit a114c81

Please sign in to comment.