Skip to content
Merged
Changes from 1 commit
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,174 @@
package com.poti.android.presentation.history.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
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.RoundedCornerShape
import androidx.compose.material3.Icon
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.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.poti.android.R
import com.poti.android.core.designsystem.theme.PotiTheme
import com.poti.android.core.designsystem.theme.PotiTheme.colors
import com.poti.android.core.designsystem.theme.PotiTheme.typography

enum class CardHistorySize(
val imageSize: Dp,
) {
SMALL(imageSize = 81.dp),
LARGE(imageSize = 96.dp),
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p1: ๊ณ ์ • ์‚ฌ์ด์ฆˆ๊ฐ€ ์•„๋‹Œ ๊ฒƒ ๊ฐ™์€๋ฐ..!
ํ…์ŠคํŠธ Column์— ์˜ํ•ด ๋†’์ด๊ฐ€ ๊ฒฐ์ •๋˜๊ณ  ์ด๋ฏธ์ง€๊ฐ€ ๋†’์ด๋ฅผ ๊ฐ€๋“ ์ฑ„์šฐ๋Š” ๊ตฌ์กฐ๋กœ ๋ณด์—ฌ์šฉ
image

val CardHistorySize.artistStyle: TextStyle
@Composable get() = when (this) {
CardHistorySize.SMALL -> typography.caption12m
CardHistorySize.LARGE -> typography.body14m
}

val CardHistorySize.titleStyle: TextStyle
@Composable get() = when (this) {
CardHistorySize.SMALL -> typography.body14m
CardHistorySize.LARGE -> typography.body16m
}

@Composable
fun HistoryCardHistory(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: ์ด๊ฑฐ History๊ฐ€ ๋‘ ๋ฒˆ ๋“ค์–ด๊ฐ€์„œ ์ข€ ์–ด์ƒ‰ํ•œ๋“ฏ?? ๊ทธ๋ƒฅ HistoryCard๋‚˜ HistoryCardItem ์–ด๋– ์‹ ๊ฐ€์š”

sizeType: CardHistorySize,
imageUrl: String,
artist: String,
title: String,
participantState: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
) {
val isPressed by interactionSource.collectIsPressedAsState()

Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(if (isPressed) colors.gray100 else colors.white)
.clickable(
interactionSource = interactionSource,
indication = null,
onClick = onClick,
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.noRippleClickable(
    interactionSource = interactionSource,
    onClick = onClick,
)

P2: noRippleClickable() ํ™•์žฅํ•จ์ˆ˜ ์ ์šฉ ๊ฐ€๋Šฅํ•  ๊ฒƒ ๊ฐ™์•„์œ 

.padding(8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
AsyncImage(
model = imageUrl,
contentDescription = null,
modifier = Modifier
.size(sizeType.imageSize)
.clip(RoundedCornerShape(8.dp)),
contentScale = ContentScale.Crop,
)

Column(
modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(2.dp),
) {
Text(
text = artist,
style = sizeType.artistStyle,
color = colors.gray800,
)
Comment on lines +102 to +108
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p1: ์—ฌ๊ธฐ๋‘ maxLines=1 ์ ์šฉํ•ด์ฃผ๋ฉด ์ข‹์„ ๋“ฏ!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ํ˜น์‹œ ๋ชจ๋ฅด๋‹ˆ๊นŒ Ellipsis๋„?


Text(
text = title,
style = sizeType.titleStyle,
color = colors.black,
)
Comment on lines +114 to +120
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p1: ์—ฌ๊ธฐ maxLines=1 / Elipses(?) ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค! ์ œ๊ฐ€ ๋””์Œคํ•œํ…Œ ๋ฌผ์–ด๋ด„


Spacer(modifier = Modifier.height(12.dp))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p1: verticalArrangement = Arrangement.spacedBy(2.dp)๊ฐ€ ์ ์šฉ๋˜์–ด ์žˆ์–ด, ๋ณธ Spacer๋กœ ์ธํ•ด 16dp ์—ฌ๋ฐฑ์ด ์ƒ๊ธฐ๋Š” ๊ฒƒ ๊ฐ™์•„์š”!
verticalArrangement = Arrangement.spacedBy(2.dp) ์—†์• ์ฃผ๋Š” ํŽธ์ด ์ข‹์•„๋ณด์ž…๋‹ˆ๋‹น

๋˜ํ•œ SMALL/LARGE์ผ ๋•Œ ์—ฌ๊ธฐ ์—ฌ๋ฐฑ์ด ๋‹ฌ๋ผ์š”! LARGE์ผ ๋•Œ๋Š” 22dp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: ๊ทธ๋ฆฌ๊ณ  ์—ฌ๊ธฐ column์—๋„ ์œ„์•„๋ž˜ ์—ฌ๋ฐฑ large์ผ ๋•Œ๋ž‘ small์ผ ๋•Œ ํŒจ๋”ฉ ๋‹ฌ๋ผ์š”. large์ผ ๋•Œ๋Š” ์œ„์•„๋ž˜ 4.dp ํŒจ๋”ฉ์ธ๋ฐ small์ผ ๋•Œ๋Š” ์œ„์— 2.dp๊ณ  ์•„๋ž˜์— 4.dp ์ž„!


// TODO: [์ฒœ๋ฏผ์žฌ] ์ž„์‹œ ์ปดํฌ๋„ŒํŠธ
ParticipantState(state = participantState)
}

Icon(
painter = painterResource(id = R.drawable.ic_arrow_right_lg),
contentDescription = null,
tint = colors.gray700,
)
}
}

// TODO: [์ฒœ๋ฏผ์žฌ] ์ž„์‹œ ์ปดํฌ๋„ŒํŠธ
@Composable
fun ParticipantState(
modifier: Modifier = Modifier,
state: String,
) {
val (text, color) = when (state) {
"done" -> "๋ชจ์ง‘ ์™„๋ฃŒ" to colors.poti600
"wait" -> "์ž…๊ธˆ ๋Œ€๊ธฐ" to colors.sementicRed
else -> "์ƒํƒœ" to colors.gray800
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: ์ŠคํŠธ๋ง ์ถ”์ถœ ํ•ด์ฃผ์„ธ์š”! ๊ทธ๋ฆฌ๊ณ  ์ด๊ฑฐ enum class๋กœ ๋นผ๋ฉด ์ข‹์„ ๋“ฏ

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

์š”๊ณ ๋Š” ์ž„์‹œ ์ปดํฌ๋„ŒํŠธ์ธ๋ฐ ํ•„์š”ํ•œ ์ปดํฌ๋„ŒํŠธ ๋จธ์ง€๋˜์„œ ์ˆ˜์ •ํ• ๊ฒŒ์š”


Text(
text = text,
modifier = modifier,
style = typography.body14sb,
color = color,
)
}

@Preview
@Composable
private fun HistoryCardHistoryPreview() {
var status by remember { mutableStateOf("done") }

PotiTheme {
Column(
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
HistoryCardHistory(
modifier = Modifier.width(344.dp),
sizeType = CardHistorySize.LARGE,
imageUrl = "",
artist = "ive(์•„์ด๋ธŒ)",
title = "๋Ÿฌ๋ธŒ๋‹ค์ด๋ธŒ ์œ„๋“œ๋ฎค",
participantState = status,
onClick = { status = if (status == "done") "wait" else "done" },
)

HistoryCardHistory(
modifier = Modifier.width(344.dp),
sizeType = CardHistorySize.SMALL,
imageUrl = "",
artist = "ive(์•„์ด๋ธŒ)",
title = "๋Ÿฌ๋ธŒ๋‹ค์ด๋ธŒ ์œ„๋“œ๋ฎค",
participantState = status,
onClick = { status = if (status == "done") "wait" else "done" },
)
}
}
}