-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/#33: modal view component DetailModalBottomBar 구현
detail modal 하단 고정 부분 구현
- Loading branch information
1 parent
157f6b4
commit 7c3eca3
Showing
9 changed files
with
375 additions
and
8 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
63 changes: 63 additions & 0 deletions
63
...ava/org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomBar.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,63 @@ | ||
package org.techtown.twosomeheart.presentation.detail.modal.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.techtown.twosomeheart.ui.theme.White | ||
|
||
|
||
@Composable | ||
fun DetailModalBottomBar( | ||
price: String, | ||
onQuantityButtonClick: (Int) -> Unit, | ||
onStarButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
isEnabled: Boolean = false | ||
) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background(White) | ||
) { | ||
PriceQuantitySelection( | ||
price = price, | ||
onQuantityButtonClick = onQuantityButtonClick) | ||
|
||
Spacer(Modifier.height(20.dp)) | ||
|
||
DetailModalBottomButtons( | ||
onStarButtonClick = onStarButtonClick, | ||
isEnabled = isEnabled | ||
) | ||
|
||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun DetailModalBottomBarPreview() { | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
){ | ||
DetailModalBottomBar( | ||
price = "1,000원", | ||
onQuantityButtonClick = {}, | ||
onStarButtonClick = {} | ||
) | ||
|
||
DetailModalBottomBar( | ||
price = "1,000원", | ||
onQuantityButtonClick = {}, | ||
onStarButtonClick = {}, | ||
isEnabled = true | ||
) | ||
} | ||
|
||
} |
157 changes: 157 additions & 0 deletions
157
...org/techtown/twosomeheart/presentation/detail/modal/component/DetailModalBottomButtons.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,157 @@ | ||
package org.techtown.twosomeheart.presentation.detail.modal.component | ||
|
||
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.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.res.vectorResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.techtown.twosomeheart.R | ||
import org.techtown.twosomeheart.core.extension.noRippleClickable | ||
import org.techtown.twosomeheart.ui.theme.Black | ||
import org.techtown.twosomeheart.ui.theme.Gray20 | ||
import org.techtown.twosomeheart.ui.theme.Gray50 | ||
import org.techtown.twosomeheart.ui.theme.Red40 | ||
import org.techtown.twosomeheart.ui.theme.Red40_40 | ||
import org.techtown.twosomeheart.ui.theme.TwosomeHeartTypography | ||
import org.techtown.twosomeheart.ui.theme.White | ||
|
||
@Composable | ||
fun DetailModalBottomButtons( | ||
onStarButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
isEnabled: Boolean = false | ||
) { | ||
Row( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background(White) | ||
.padding(horizontal = 16.dp), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
ModalCartButton( | ||
modifier = modifier, | ||
isEnabled = isEnabled | ||
) | ||
ModalStarButton( | ||
onClick = { | ||
onStarButtonClick() | ||
}, | ||
modifier = modifier, | ||
isEnabled = isEnabled | ||
) | ||
ModalOrderButton( | ||
modifier = modifier, | ||
isEnabled = isEnabled | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun ModalCartButton( | ||
modifier: Modifier = Modifier, | ||
isEnabled: Boolean = false | ||
) { | ||
Box( | ||
modifier = modifier | ||
.background( | ||
if (isEnabled) Red40 else Red40_40 | ||
) | ||
) { | ||
Icon( | ||
imageVector = if (isEnabled) ImageVector.vectorResource(R.drawable.ic_modal_shop_able) else ImageVector.vectorResource(R.drawable.ic_modal_shop_disable), | ||
contentDescription = null, | ||
tint = Color.Unspecified, | ||
modifier = Modifier.padding( | ||
vertical = 16.dp, | ||
horizontal = 18.dp | ||
) | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun ModalStarButton( | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
isEnabled: Boolean = false | ||
) { | ||
Box( | ||
modifier = modifier | ||
.background(White) | ||
.border( | ||
width = 1.dp, | ||
color = if (isEnabled) Red40 else Red40_40, | ||
) | ||
) { | ||
Icon( | ||
imageVector = if (isEnabled) ImageVector.vectorResource(R.drawable.ic_modal_star_able) else ImageVector.vectorResource(R.drawable.ic_modal_star_disable), | ||
contentDescription = null, | ||
tint = Color.Unspecified, | ||
modifier = Modifier | ||
.padding( | ||
vertical = 16.dp, | ||
horizontal = 18.dp | ||
) | ||
.noRippleClickable { | ||
if(isEnabled) { | ||
onClick() | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun ModalOrderButton( | ||
modifier: Modifier = Modifier, | ||
isEnabled: Boolean = false | ||
) { | ||
Text( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background( | ||
if (isEnabled) Black else Gray20 | ||
) | ||
.padding( | ||
top = 4.dp, | ||
bottom = 4.dp, | ||
start = 62.dp, | ||
end = 63.dp | ||
), | ||
text = stringResource(R.string.menu_detail_order_text), | ||
color = if (isEnabled) White else Gray50, | ||
textAlign = TextAlign.Center, | ||
style = if (isEnabled) TwosomeHeartTypography.head4B18 else TwosomeHeartTypography.head4M18 | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun DetailModalBottomButtonsPreview() { | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
DetailModalBottomButtons( | ||
onStarButtonClick = {} | ||
) | ||
|
||
DetailModalBottomButtons( | ||
onStarButtonClick = {}, | ||
isEnabled = true | ||
) | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
...a/org/techtown/twosomeheart/presentation/detail/modal/component/PriceQuantitySelection.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,84 @@ | ||
package org.techtown.twosomeheart.presentation.detail.modal.component | ||
|
||
import androidx.compose.foundation.background | ||
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.padding | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import org.techtown.twosomeheart.core.component.ModalQuantityButton | ||
import org.techtown.twosomeheart.ui.theme.Black | ||
import org.techtown.twosomeheart.ui.theme.TwosomeHeartTypography | ||
import org.techtown.twosomeheart.ui.theme.White | ||
|
||
@Composable | ||
fun PriceQuantitySelection( | ||
price: String, | ||
onQuantityButtonClick: (Int) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
|
||
val quantity = remember{ mutableIntStateOf(1) } | ||
|
||
Column ( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background(White) | ||
.padding(horizontal = 16.dp) | ||
) { | ||
|
||
HorizontalDivider( | ||
thickness = 1.dp, | ||
color = Black | ||
) | ||
|
||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
) { | ||
Text( | ||
text = price, | ||
style = TwosomeHeartTypography.title1B16, | ||
color = Black, | ||
modifier = Modifier.padding( | ||
top = 28.dp | ||
) | ||
) | ||
|
||
Spacer(modifier = Modifier.weight(1f)) | ||
|
||
ModalQuantityButton( | ||
onClickMinusButton = { | ||
quantity.intValue -= 1 | ||
onQuantityButtonClick(quantity.intValue) | ||
}, | ||
onClickPlusButton = { | ||
quantity.intValue += 1 | ||
onQuantityButtonClick(quantity.intValue) | ||
}, | ||
amount = quantity.intValue, | ||
modifier = Modifier | ||
.padding( | ||
top = 24.dp | ||
) | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PriceQuantitySelectionPreview() { | ||
PriceQuantitySelection( | ||
price = "1,000원", | ||
onQuantityButtonClick = {} | ||
) | ||
} |
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,16 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:strokeWidth="1" | ||
android:pathData="M4.152,5.156h15.696v15.788h-15.696z" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#ffffff"/> | ||
<path | ||
android:strokeWidth="1" | ||
android:pathData="M15.459,5.2H8.519L9.27,3.057H14.709L15.459,5.2Z" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#ffffff"/> | ||
</vector> |
Oops, something went wrong.