-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI/#63] AlarmListDropDownMenu 컴포넌트 구현
- Loading branch information
1 parent
5792a8c
commit c766403
Showing
5 changed files
with
130 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="20dp" | ||
android:height="20dp" | ||
android:viewportWidth="20" | ||
android:viewportHeight="20"> | ||
<path | ||
android:pathData="M3.333,5C3.333,4.54 3.706,4.167 4.166,4.167H13.333C13.793,4.167 14.166,4.54 14.166,5C14.166,5.461 13.793,5.834 13.333,5.834H4.166C3.706,5.834 3.333,5.461 3.333,5ZM3.333,8.334C3.333,7.873 3.706,7.5 4.166,7.5H10.833C11.293,7.5 11.666,7.873 11.666,8.334C11.666,8.794 11.293,9.167 10.833,9.167H4.166C3.706,9.167 3.333,8.794 3.333,8.334ZM4.166,10.834C3.706,10.834 3.333,11.207 3.333,11.667C3.333,12.127 3.706,12.5 4.166,12.5H7.5C7.96,12.5 8.333,12.127 8.333,11.667C8.333,11.207 7.96,10.834 7.5,10.834H4.166ZM14.457,7.957C14.733,7.665 15.106,7.5 15.496,7.5C15.689,7.5 15.88,7.541 16.058,7.619C16.236,7.697 16.398,7.812 16.534,7.957C16.671,8.102 16.779,8.274 16.853,8.463C16.926,8.652 16.964,8.855 16.964,9.06C16.964,9.265 16.926,9.467 16.853,9.657C16.779,9.846 16.671,10.018 16.534,10.163L11.007,16.032C10.939,16.104 10.854,16.156 10.761,16.181L8.992,16.65C8.811,16.698 8.62,16.642 8.488,16.502C8.357,16.362 8.304,16.159 8.349,15.967L8.791,14.088C8.814,13.989 8.863,13.899 8.931,13.827L14.457,7.957Z" | ||
android:fillColor="#ffffff" | ||
android:fillType="evenOdd"/> | ||
</vector> |
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
115 changes: 115 additions & 0 deletions
115
feature/home/src/main/java/com/yapp/home/component/AlarmListDropDownMenu.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,115 @@ | ||
package com.yapp.home.component | ||
|
||
import android.util.Log | ||
import androidx.annotation.DrawableRes | ||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
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.Button | ||
import androidx.compose.material3.DropdownMenu | ||
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.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.yapp.designsystem.theme.OrbitTheme | ||
import com.yapp.ui.extensions.customClickable | ||
import feature.home.R | ||
|
||
@Composable | ||
private fun AlarmListDropDownMenu( | ||
modifier: Modifier = Modifier, | ||
expanded: Boolean, | ||
onDismissRequest: () -> Unit, | ||
onClickEdit: () -> Unit, | ||
) { | ||
DropdownMenu( | ||
modifier = modifier.padding(6.dp), | ||
expanded = expanded, | ||
onDismissRequest = onDismissRequest, | ||
containerColor = OrbitTheme.colors.gray_700, | ||
shape = RoundedCornerShape(16.dp), | ||
border = BorderStroke(1.dp, OrbitTheme.colors.gray_600), | ||
) { | ||
AlarmListDropDownMenuItem( | ||
text = stringResource(id = R.string.alarm_list_bottom_sheet_menu_edit), | ||
iconRes = core.designsystem.R.drawable.ic_edit, | ||
) { | ||
onClickEdit() | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun AlarmListDropDownMenuItem( | ||
text: String, | ||
@DrawableRes iconRes: Int, | ||
onClick: () -> Unit, | ||
) { | ||
Row( | ||
modifier = Modifier | ||
.width(120.dp) | ||
.customClickable( | ||
onClick = onClick, | ||
rippleEnabled = false, | ||
) | ||
.padding( | ||
horizontal = 14.dp, | ||
vertical = 8.dp, | ||
), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
Text( | ||
text = text, | ||
style = OrbitTheme.typography.body1SemiBold, | ||
color = OrbitTheme.colors.white, | ||
) | ||
|
||
Icon( | ||
modifier = Modifier.size(20.dp), | ||
painter = painterResource(id = iconRes), | ||
contentDescription = "Icon", | ||
tint = OrbitTheme.colors.white, | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun AlarmListDropDownMenuPreview() { | ||
var expanded by remember { mutableStateOf(false) } | ||
|
||
OrbitTheme { | ||
Box( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
Box { | ||
Button( | ||
onClick = { expanded = true }, | ||
) { | ||
Text("Show Menu") | ||
} | ||
AlarmListDropDownMenu( | ||
expanded = expanded, | ||
onDismissRequest = { expanded = false }, | ||
onClickEdit = { | ||
Log.d("AlarmListDropDownMenu", "Edit Clicked") | ||
}, | ||
) | ||
} | ||
} | ||
} | ||
} |
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