|
1 | 1 | package com.ninecraft.booket.feature.detail.book.component |
2 | 2 |
|
| 3 | +import androidx.compose.foundation.background |
| 4 | +import androidx.compose.foundation.border |
| 5 | +import androidx.compose.foundation.layout.Arrangement |
3 | 6 | import androidx.compose.foundation.layout.Box |
| 7 | +import androidx.compose.foundation.layout.Column |
| 8 | +import androidx.compose.foundation.layout.Row |
| 9 | +import androidx.compose.foundation.layout.Spacer |
| 10 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 11 | +import androidx.compose.foundation.layout.height |
| 12 | +import androidx.compose.foundation.layout.padding |
| 13 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 14 | +import androidx.compose.material3.Text |
4 | 15 | import androidx.compose.runtime.Composable |
| 16 | +import androidx.compose.ui.Modifier |
| 17 | +import androidx.compose.ui.draw.clip |
| 18 | +import androidx.compose.ui.res.stringResource |
| 19 | +import androidx.compose.ui.text.style.TextAlign |
| 20 | +import androidx.compose.ui.unit.dp |
| 21 | +import com.ninecraft.booket.core.common.util.buildEmotionText |
| 22 | +import com.ninecraft.booket.core.designsystem.ComponentPreview |
| 23 | +import com.ninecraft.booket.core.designsystem.theme.ReedTheme |
| 24 | +import com.ninecraft.booket.feature.detail.R |
5 | 25 | import com.ninecraft.booket.feature.detail.book.BookDetailUiState |
6 | 26 |
|
| 27 | +// TODO 필요한 파라미터만 선언하여 사용하기 |
7 | 28 | @Composable |
8 | 29 | internal fun CollectedSeed( |
9 | | - state: BookDetailUiState |
| 30 | + state: BookDetailUiState, |
10 | 31 | ) { |
11 | | - Box {} |
| 32 | + Column( |
| 33 | + modifier = Modifier |
| 34 | + .fillMaxWidth() |
| 35 | + .padding( |
| 36 | + start = ReedTheme.spacing.spacing5, |
| 37 | + top = ReedTheme.spacing.spacing5, |
| 38 | + end = ReedTheme.spacing.spacing5, |
| 39 | + bottom = ReedTheme.spacing.spacing6, |
| 40 | + ) |
| 41 | + .clip(RoundedCornerShape(ReedTheme.radius.md)) |
| 42 | + .background(ReedTheme.colors.baseSecondary), |
| 43 | + ) { |
| 44 | + Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing4)) |
| 45 | + Text( |
| 46 | + text = stringResource(R.string.collected_seed_title), |
| 47 | + modifier = Modifier.padding(horizontal = ReedTheme.spacing.spacing4), |
| 48 | + color = ReedTheme.colors.contentSecondary, |
| 49 | + style = ReedTheme.typography.body2Medium, |
| 50 | + ) |
| 51 | + Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing5)) |
| 52 | + Row( |
| 53 | + modifier = Modifier.fillMaxWidth(), |
| 54 | + horizontalArrangement = Arrangement.SpaceEvenly, |
| 55 | + ) { |
| 56 | + state.emotionList.forEach { emotion -> |
| 57 | + SeedItem(emotion = emotion) |
| 58 | + } |
| 59 | + } |
| 60 | + Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing5)) |
| 61 | + Box( |
| 62 | + modifier = Modifier |
| 63 | + .fillMaxWidth() |
| 64 | + .padding(horizontal = ReedTheme.spacing.spacing4) |
| 65 | + .clip(RoundedCornerShape(ReedTheme.radius.sm)) |
| 66 | + .background(ReedTheme.colors.basePrimary) |
| 67 | + .padding(ReedTheme.spacing.spacing3) |
| 68 | + .border( |
| 69 | + width = 1.dp, |
| 70 | + color = ReedTheme.colors.basePrimary, |
| 71 | + shape = RoundedCornerShape(ReedTheme.radius.sm), |
| 72 | + ), |
| 73 | + ) { |
| 74 | + Text( |
| 75 | + text = buildEmotionText( |
| 76 | + emotions = state.emotionList, |
| 77 | + brandColor = ReedTheme.colors.contentBrand, |
| 78 | + secondaryColor = ReedTheme.colors.contentSecondary, |
| 79 | + emotionTextStyle = ReedTheme.typography.label2SemiBold, |
| 80 | + regularTextStyle = ReedTheme.typography.label2Regular, |
| 81 | + ), |
| 82 | + modifier = Modifier.fillMaxWidth(), |
| 83 | + textAlign = TextAlign.Center, |
| 84 | + ) |
| 85 | + } |
| 86 | + Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing4)) |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +@ComponentPreview |
| 91 | +@Composable |
| 92 | +private fun CollectedSeedPreview() { |
| 93 | + ReedTheme { |
| 94 | + CollectedSeed( |
| 95 | + state = BookDetailUiState( |
| 96 | + eventSink = {}, |
| 97 | + ), |
| 98 | + ) |
| 99 | + } |
12 | 100 | } |
0 commit comments