Skip to content

Commit

Permalink
#310 [ui] RuleNavGraph, 대표룰 Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Sep 2, 2023
1 parent cc369bb commit 58c49cc
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ fun RuleNavGraph(
mainRuleScreen(navController)
addRuleScreen(navController::popBackStack)
updateRuleScreen(navController)
representativeRuleScreen(navController::popBackStack)
}
}

Expand Down Expand Up @@ -214,6 +215,10 @@ private fun NavGraphBuilder.addRuleScreen(onBack: () -> Unit) {
}
}

private fun NavGraphBuilder.representativeRuleScreen(onBack: () -> Unit) {
composable(RulesScreens.Represent.route) {
}
}
// Navigation

fun NavController.navigateToAddRule() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package hous.release.android.presentation.our_rules.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import hous.release.android.R
import hous.release.android.presentation.our_rules.component.RuleToolbar
import hous.release.android.presentation.our_rules.component.represent.RepresentRuleList
import hous.release.android.presentation.our_rules.model.RepresentRuleUiModel
import hous.release.designsystem.theme.HousTheme
import hous.release.domain.entity.rule.Rule

@Composable
fun RepresentRuleScreen(
rules: List<RepresentRuleUiModel> = emptyList(),
isChanged: Boolean = false,
onSave: () -> Unit = {},
onBack: () -> Unit = {},
onRuleClick: (Int) -> Unit = {}
) {
Column(
modifier = Modifier.fillMaxSize()
) {
RuleToolbar(
title = stringResource(id = R.string.our_rule_represent_rule_title),
trailingTitle = stringResource(id = R.string.our_rule_save_new_rule),
isButtonActive = isChanged,
onBack = onBack,
onAddButton = onSave
)
Spacer(modifier = Modifier.height(20.dp))
RepresentRuleList(
rules = rules,
onClick = onRuleClick
)
}
}

@Preview("대표룰 Screen - General", showBackground = true)
@Composable
private fun Preview1() {
HousTheme {
RepresentRuleScreen(
rules = listOf(
Rule(
id = 1,
name = "text1",
isRepresent = true
),
Rule(id = 2, "text 2")
).map { RepresentRuleUiModel.from(it) }
)
}
}

@Preview("대표룰 Screen - Empty", showBackground = true)
@Composable
private fun Preview2() {
HousTheme {
RepresentRuleScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ sealed class RulesScreens(val route: String) {

object Update : RulesScreens("update")

object Represent : RulesScreens("represent")

companion object {
private const val DETAIL_RULE_GRAPH_ROUTE = "detail_rules_graph"
const val RULE_GRAPH_ROUTE = "rules"
const val DETAIL_RULE_KEY = "id"
}
Expand Down

0 comments on commit 58c49cc

Please sign in to comment.