-
Notifications
You must be signed in to change notification settings - Fork 39
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
π 4λ¨κ³ - μ₯λ°κ΅¬λ(μλ) #126
base: sana-20
Are you sure you want to change the base?
Changes from all commits
8a858c5
49cccd2
1ae4bc0
2430a21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ λ² λ―Έμ μμ #122 (comment) μ½λ§¨νΈλ₯Ό μμ±νλλ° λ΅λ³μ΄ κ°λ₯νμ€κΉμ? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package nextstep.shoppingcart.view | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun ProductCount( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ₯λ°κ΅¬λ νλ©΄μμλ ProductCountλ₯Ό μ¬μ©νκ³ μλλ°μ. |
||
count: Int, | ||
onClickAddOne: () -> Unit, | ||
onClickRemoveOne: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
modifier = modifier | ||
) { | ||
IconButton( | ||
onClick = onClickRemoveOne, | ||
modifier = Modifier.size(42.dp) | ||
) { | ||
Text( | ||
text = "-", | ||
fontSize = 22.sp, | ||
fontWeight = FontWeight.Bold | ||
) | ||
} | ||
Comment on lines
+28
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
Text( | ||
text = count.toString(), | ||
fontSize = 22.sp, | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier.padding(horizontal = 18.dp) | ||
) | ||
IconButton( | ||
onClick = onClickAddOne, | ||
modifier = Modifier.size(42.dp) | ||
) { | ||
Text( | ||
text = "+", | ||
fontSize = 22.sp, | ||
fontWeight = FontWeight.Bold, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun CartProductCountPreview() { | ||
ProductCount( | ||
count = 2, | ||
onClickAddOne = {}, | ||
onClickRemoveOne = {} | ||
) | ||
Comment on lines
+60
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previewμλ Interactive modeλΌλ κΈ°λ₯μ μ 곡νκ³ μμ΅λλ€. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StateListμ SnapshotListλ‘ λ³κ²½νμ μ΄μ κ° λ¬΄μμΈκ°μ?