Skip to content

Commit

Permalink
[FEAT/#66] SearchResultItem 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
angryPodo committed Jan 17, 2025
1 parent db746de commit ed05c67
Showing 1 changed file with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.spoony.spoony.presentation.register.componet

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
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.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.spoony.spoony.R
import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme
import com.spoony.spoony.core.util.extension.noRippleClickable

@Composable
fun SearchResultItem(
placeName: String,
placeRoadAddress: String,
onResultClick: () -> Unit,
onDeleteClick: () -> Unit,
modifier: Modifier = Modifier
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
modifier = modifier
.clip(RoundedCornerShape(8.dp))
.fillMaxWidth()
.border(1.dp, SpoonyAndroidTheme.colors.gray100)
.background(Color.White)
.noRippleClickable { onResultClick }
.padding(horizontal = 12.dp)
) {
Row(
verticalAlignment = Alignment.Top,
horizontalArrangement = Arrangement.Start,
modifier = Modifier.padding(vertical = 10.dp)
) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_pin_24),
contentDescription = null,
modifier = Modifier.size(20.dp)
)
Spacer(modifier = Modifier.width(4.dp))
Column {
Text(
text = placeName,
style = SpoonyAndroidTheme.typography.body2b,
color = SpoonyAndroidTheme.colors.black,
maxLines = 1
)
Spacer(modifier = Modifier.height(2.dp))
Text(
text = placeRoadAddress,
style = SpoonyAndroidTheme.typography.caption1m,
color = SpoonyAndroidTheme.colors.gray500,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_delete_filled_24),
contentDescription = null,
tint = SpoonyAndroidTheme.colors.gray400,
modifier = Modifier.noRippleClickable { onDeleteClick }
)
}
}

@Preview
@Composable
private fun SearchResultPreview() {
SpoonyAndroidTheme {
Box(modifier = Modifier.width(340.dp).padding(vertical = 20.dp)) {
SearchResultItem(
placeName = "테스트점",
placeRoadAddress = "우리집 어쩌구",
onResultClick = {},
onDeleteClick = {}
)
}
}
}

0 comments on commit ed05c67

Please sign in to comment.