Skip to content

Commit

Permalink
style: Apply Spotless Format
Browse files Browse the repository at this point in the history
  • Loading branch information
wnsgur1 committed Mar 31, 2024
1 parent b2dc065 commit 2cd2a3d
Showing 1 changed file with 25 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.apeun.gidaechi.designsystem.component

import android.graphics.ColorMatrix
import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
Expand All @@ -10,7 +8,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
Expand All @@ -26,9 +23,9 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand All @@ -37,7 +34,6 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.times
import com.apeun.gidaechi.designsystem.component.modifier.DropShadowType
import com.apeun.gidaechi.designsystem.theme.Black
import com.apeun.gidaechi.designsystem.theme.Gray200
import com.apeun.gidaechi.designsystem.theme.Gray300
Expand All @@ -49,20 +45,14 @@ import com.apeun.gidaechi.designsystem.theme.White
sealed class DropDownType(
val textColor: Color,
val backgroundColor: Color,
val iconColor: Color
){
val iconColor: Color,
) {
data object Disabled : DropDownType(Gray400, Gray200, Gray400)
data object Typing : DropDownType(Black, Gray300, Gray500)

}

@Composable
fun SeugiDropDown(
item: List<String>,
title: String,
type: DropDownType
) {

fun SeugiDropDown(item: List<String>, title: String, type: DropDownType) {
var isExpanded by remember {
mutableStateOf(false)
}
Expand All @@ -78,19 +68,18 @@ fun SeugiDropDown(
Icons.Filled.KeyboardArrowDown
}


val clickableModifier = if (type != DropDownType.Disabled){
val clickableModifier = if (type != DropDownType.Disabled) {
Modifier.clickable { isExpanded = !isExpanded }
}else{
} else {
Modifier
}


SeugiTheme {
Column(modifier = Modifier
.padding(20.dp)
.clip(RoundedCornerShape(12.dp))
.then(clickableModifier)
Column(
modifier = Modifier
.padding(20.dp)
.clip(RoundedCornerShape(12.dp))
.then(clickableModifier),
) {
Box(
modifier = Modifier
Expand All @@ -99,20 +88,20 @@ fun SeugiDropDown(
.border(1.dp, type.backgroundColor, RoundedCornerShape(12.dp))
.background(White, RoundedCornerShape(12.dp))
.clip(RoundedCornerShape(12.dp))
.padding(horizontal = 16.dp, vertical = 12.dp)
.padding(horizontal = 16.dp, vertical = 12.dp),

) {
Text(
text = selectedItem,
modifier = Modifier.align(Alignment.CenterStart),
style = MaterialTheme.typography.titleMedium,
color = if (selectedItem == title) Gray500 else Black
color = if (selectedItem == title) Gray500 else Black,
)
Icon(
imageVector = icon,
contentDescription = null,
modifier = Modifier.align(Alignment.CenterEnd),
tint = type.iconColor
tint = type.iconColor,
)
}

Expand All @@ -123,27 +112,25 @@ fun SeugiDropDown(
.width(300.dp)
.align(Alignment.CenterHorizontally)
.height(calculateDropdownHeight(item.size))
.background(White)
,
scrollState = scrollState
.background(White),
scrollState = scrollState,
) {

item.forEach { label ->
DropdownMenuItem(
onClick = {
selectedItem = label
isExpanded = false
},
text = {
Text(text = label,
Text(
text = label,
style = MaterialTheme.typography.titleMedium,
color = type.textColor)
},
modifier = Modifier.background(White)
color = type.textColor,
)
},
modifier = Modifier.background(White),
)
}


}
}
}
Expand All @@ -158,27 +145,22 @@ fun calculateDropdownHeight(itemCount: Int): Dp {
return calculatedHeight
}


@Composable
@Preview(showBackground = true)
fun PreviewSeugiDropdown() {
val dummyList = listOf("1", "2","1", "2","1", "2","1", "2","1", "2","1", "2")
val dummyList = listOf("1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2")

SeugiTheme {

Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
verticalArrangement = Arrangement.Center,
) {


SeugiDropDown(dummyList, "비밀번호 선택", DropDownType.Disabled)

Spacer(modifier = Modifier.padding(horizontal = 20.dp))

SeugiDropDown(dummyList, "비밀번호 선택", DropDownType.Typing)

}
}
}
}

0 comments on commit 2cd2a3d

Please sign in to comment.