Skip to content

Commit

Permalink
[CHORE/#16] text 타입 Int로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 7, 2024
1 parent 5a860ac commit 9c5c0f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.terning.core.designsystem.component.button

import androidx.annotation.StringRes
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme

Expand All @@ -15,16 +17,16 @@ fun RectangleButton(
modifier: Modifier = Modifier,
style: TextStyle,
paddingVertical: Dp,
@StringRes text: Int,
isEnabled: Boolean = true,
text: String = "",
onButtonClick: () -> Unit,
) {
TerningBasicButton(
modifier = modifier,
style = style,
paddingVertical = paddingVertical,
isEnabled = isEnabled,
text = text,
isEnabled = isEnabled,
shape = RoundedCornerShape(0.dp),
onButtonClick = onButtonClick,
)
Expand All @@ -36,7 +38,7 @@ fun RectangleButtonPreview() {
TerningPointTheme {
RectangleButton(
style = TerningTheme.typography.button0,
text = "RectangleButton",
text = R.string.button_preview,
paddingVertical = 19.dp,
onButtonClick = {}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.terning.core.designsystem.component.button

import androidx.annotation.StringRes
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme

Expand All @@ -16,17 +18,17 @@ fun RoundButton(
style: TextStyle,
paddingVertical: Dp,
cornerRadius: Dp,
@StringRes text: Int,
isEnabled: Boolean = true,
text: String = "",
onButtonClick: () -> Unit,
) {
TerningBasicButton(
modifier = modifier,
style = style,
paddingVertical = paddingVertical,
shape = RoundedCornerShape(cornerRadius),
isEnabled = isEnabled,
text = text,
isEnabled = isEnabled,
onButtonClick = onButtonClick,
)
}
Expand All @@ -37,7 +39,7 @@ fun RoundButtonPreview() {
TerningPointTheme {
RoundButton(
style = TerningTheme.typography.button0,
text = "RoundButton",
text = R.string.button_preview,
paddingVertical = 19.dp,
cornerRadius = 10.dp,
onButtonClick = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.terning.core.designsystem.component.button

import androidx.annotation.StringRes
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -14,10 +15,12 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.TerningMain
Expand All @@ -33,8 +36,8 @@ fun TerningBasicButton(
shape: Shape,
style: TextStyle,
paddingVertical: Dp,
@StringRes text: Int,
isEnabled: Boolean = true,
text: String = "",
onButtonClick: () -> Unit
) {
val interactionSource = remember { MutableInteractionSource() }
Expand All @@ -56,7 +59,7 @@ fun TerningBasicButton(
onClick = { onButtonClick() }
) {
Text(
text = text,
text = stringResource(id = text),
style = style,
modifier = modifier.padding(vertical = paddingVertical)
)
Expand All @@ -69,7 +72,7 @@ fun TerningBasicButton(
fun TerningBasicButtonPreview() {
TerningPointTheme {
TerningBasicButton(
text = "Button",
text = R.string.button_preview,
shape = ButtonDefaults.shape,
style = TerningTheme.typography.button0,
paddingVertical = 19.dp,
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ContentDescription-->
<!--ContentDescription-->
<string name="ic_back">뒤로가기 버튼</string>
<string name="ic_logo">탑 바 로고</string>
<string name="ic_20_right">오른쪽 버튼</string>

<!-- MyPage-->
<!-- MyPage-->
<string name="my_page_top_app_bar">프로필 수정</string>

<!-- button-->
<string name="button_preview">button</string>

</resources>

0 comments on commit 9c5c0f0

Please sign in to comment.