-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RecipeDifficult): 레시피 추천 난이도 화면을 그린다
- Loading branch information
1 parent
90345c6
commit 617585d
Showing
9 changed files
with
231 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
...recipe/src/main/java/com/sundaegukbap/banchango/feature/recipe/detail/RecipeDetailInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.sundaegukbap.banchango.feature.recipe.detail | ||
|
||
import androidx.compose.foundation.layout.Column | ||
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 | ||
import androidx.compose.foundation.layout.wrapContentSize | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.VerticalDivider | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight.Companion.Bold | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.sundaegukbap.banchango.RecipeDifficulty | ||
import com.sundaegukbap.banchango.core.designsystem.theme.BanchangoTheme | ||
import com.sundaegukbap.banchango.core.designsystem.theme.LightOrange | ||
import com.sundaegukbap.banchango.core.designsystem.theme.Orange | ||
import com.sundaegukbap.banchango.feature.recipe.difficulty.Stars | ||
|
||
@Composable | ||
fun RecipeDetailInfo( | ||
difficulty: RecipeDifficulty, | ||
serving: Int, | ||
cookingTime: Int, | ||
paddingHorizontal: Int, | ||
modifier: Modifier = Modifier | ||
) { | ||
Row(modifier = modifier.fillMaxWidth()) { | ||
RecipeDetailDifficulty( | ||
modifier = Modifier | ||
.wrapContentSize() | ||
.align(Alignment.CenterVertically) | ||
.padding(horizontal = paddingHorizontal.dp), | ||
difficulty = difficulty | ||
) | ||
|
||
RecipeLine(alignment = Alignment.CenterVertically) | ||
|
||
DetailText( | ||
modifier = Modifier.align(Alignment.CenterVertically), | ||
text = "${serving}인분", | ||
paddingHorizontal = paddingHorizontal | ||
) | ||
|
||
RecipeLine(alignment = Alignment.CenterVertically) | ||
|
||
DetailText( | ||
modifier = Modifier.align(Alignment.CenterVertically), | ||
text = "${cookingTime}m", | ||
paddingHorizontal = paddingHorizontal | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun RecipeDetailDifficulty( | ||
modifier: Modifier = Modifier, | ||
difficulty: RecipeDifficulty | ||
) { | ||
Column(modifier = modifier) { | ||
Stars( | ||
modifier = Modifier.wrapContentSize(), | ||
starSize = 14, | ||
filledCount = difficulty.level | ||
) | ||
Text( | ||
modifier = Modifier | ||
.wrapContentSize() | ||
.align(Alignment.CenterHorizontally), | ||
text = difficulty.explain, | ||
fontSize = 12.sp, | ||
fontWeight = Bold, | ||
color = Orange, | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun RowScope.RecipeLine(alignment: Alignment.Vertical) { | ||
VerticalDivider( | ||
modifier = Modifier | ||
.height(52.dp) | ||
.align(alignment), | ||
color = LightOrange, | ||
thickness = 2.dp | ||
) | ||
} | ||
|
||
@Composable | ||
private fun RowScope.DetailText( | ||
modifier: Modifier = Modifier, | ||
paddingHorizontal: Int, | ||
text: String | ||
) { | ||
Text( | ||
modifier = modifier | ||
.wrapContentSize() | ||
.padding(horizontal = paddingHorizontal.dp) | ||
.align(Alignment.CenterVertically), | ||
text = text, | ||
fontSize = 12.sp, | ||
fontWeight = Bold, | ||
color = Orange, | ||
textAlign = TextAlign.Center | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun RecipeDetailInfoPreview() { | ||
BanchangoTheme { | ||
RecipeDetailInfo( | ||
difficulty = RecipeDifficulty.ADVANCED, | ||
serving = 2, | ||
cookingTime = 30, | ||
20, | ||
) | ||
} | ||
} | ||
|
Oops, something went wrong.