Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#313 [fix] Rule dropdown menu Clip radius 값 수정 #316

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
@@ -1,24 +1,27 @@
package hous.release.android.presentation.our_rules.component.main

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.Divider
import androidx.compose.material.DropdownMenu
import androidx.compose.material.DropdownMenuItem
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Shapes
import androidx.compose.material.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.runtime.staticCompositionLocalOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
Expand All @@ -33,8 +36,8 @@ import hous.release.designsystem.theme.HousG6
import hous.release.designsystem.theme.HousTheme

private val MinMenuWidth = 139.dp
private val DropdownMenuItemContentStartPadding = 20.dp
private val DropdownDividerPadding = 14.dp
private val LocalShapes = staticCompositionLocalOf { Shapes() }
Copy link
Member

Choose a reason for hiding this comment

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

LocalShapes 변수는 사용 하지 않는 변수일까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

앗! 삭제하도록 할게유


@Composable
fun MainRuleDropDownMenu(
Expand All @@ -50,47 +53,62 @@ fun MainRuleDropDownMenu(

val dropDownOffset = DpOffset(x = screenWidth - MinMenuWidth - 32.dp, y = (-8).dp)

DropdownMenu(
modifier = Modifier
.wrapContentSize()
.sizeIn(minWidth = MinMenuWidth),
offset = dropDownOffset,
expanded = isExpanded,
onDismissRequest = onDismiss
) {
DropdownMenuItem(
onClick = onNavigateToRepresentation,
contentPadding = PaddingValues(start = DropdownMenuItemContentStartPadding)
MaterialTheme(shapes = MaterialTheme.shapes.copy(medium = RoundedCornerShape(8.dp))) {
DropdownMenu(
modifier = Modifier
.wrapContentSize()
.sizeIn(minWidth = MinMenuWidth),
offset = dropDownOffset,
expanded = isExpanded,
onDismissRequest = onDismiss
) {
Text(
text = stringResource(id = R.string.our_rule_menu_edit_representation),
style = HousTheme.typography.b2,
color = HousBlue,
modifier = Modifier.wrapContentSize()
RuleDropDownMenuContent(
onNavigateToRepresentation = onNavigateToRepresentation,
onNavigateToGuide = onNavigateToGuide
)
}
}
}

@Composable
private fun RuleDropDownMenuContent(
onNavigateToRepresentation: () -> Unit,
onNavigateToGuide: () -> Unit
) {
Column(Modifier.wrapContentSize()) {
Text(
text = stringResource(id = R.string.our_rule_menu_edit_representation),
style = HousTheme.typography.b2,
color = HousBlue,
modifier = Modifier.wrapContentSize().clickable(onClick = onNavigateToRepresentation)
.padding(start = 20.dp, end = 27.dp, top = 9.dp, bottom = 12.dp)
)
Divider(
color = HousG2,
thickness = 1.dp,
modifier = Modifier.padding(horizontal = DropdownDividerPadding)
modifier = Modifier.wrapContentSize().padding(horizontal = DropdownDividerPadding)
)
DropdownMenuItem(
onClick = onNavigateToGuide,
contentPadding = PaddingValues(start = DropdownMenuItemContentStartPadding)
) {
Text(
text = stringResource(id = R.string.our_rule_menu_edit_guide),
style = HousTheme.typography.b2,
color = HousG6,
modifier = Modifier.wrapContentSize()
)
}
Text(
text = stringResource(id = R.string.our_rule_menu_edit_guide),
style = HousTheme.typography.b2,
color = HousG6,
modifier = Modifier.wrapContentSize().clickable(onClick = onNavigateToGuide)
.padding(start = 20.dp, end = 27.dp, top = 8.dp, bottom = 12.dp)
)
}
}

@Preview(name = "MainRuleDropDown", showBackground = true)
@Composable
private fun Preview1() {
HousTheme {
RuleDropDownMenuContent({}, {})
}
}

@Preview(name = "MainRuleDropDown", showBackground = true)
@Composable
fun PreviewMainRuleDropDown() {
private fun PreviewMainRuleDropDown() {
HousTheme {
Column(
modifier = Modifier.fillMaxSize(),
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<string name="our_rule_add">추가하기</string>
<string name="our_rule_delete">삭제하기</string>
<string name="our_rule_edit">수정하기</string>
<string name="our_rule_menu_edit_representation">대표 Rules 편집</string>
<string name="our_rule_menu_edit_representation">대표 Rules 선택</string>
<string name="our_rule_menu_edit_guide">가이드 다시보기</string>
<string name="our_rule_add_edit_title">제목</string>
<string name="our_rule_add_edit_description">설명</string>
Expand Down
Loading