Skip to content

Commit

Permalink
[FIX/#16] solving conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 9, 2024
2 parents eaf301b + c617801 commit 6cb7ff2
Show file tree
Hide file tree
Showing 37 changed files with 1,275 additions and 44 deletions.
4 changes: 4 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ dependencies {
// Compose Preview
debugImplementation(libs.compose.ui.tooling)

//Compose Preview
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.ui.tooling.preview)

// Test Dependency
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable
fun BackButtonTopAppBar(
title: String, onBackButtonClick: (() -> Unit),
) {
TerningTopAppBar(
TerningBasicTopAppBar(
title = title,
showBackButton = true,
onBackButtonClick = { onBackButtonClick.invoke() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.terning.core.R

@Composable
fun LogoTopAppBar() {
TerningTopAppBar(
TerningBasicTopAppBar(
showBackButton = false,
actions = listOf {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningTypography
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun MyPageTopAppBar() {
TerningTopAppBar(
TerningBasicTopAppBar(
showBackButton = false,
actions = listOf(
{},
Expand All @@ -24,7 +24,7 @@ fun MyPageTopAppBar() {
) {
Text(
text = stringResource(id = R.string.my_page_top_app_bar),
style = TerningTypography().button3,
style = TerningTheme.typography.button3,
textAlign = TextAlign.Center
)
IconButton(onClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningTypography
import com.terning.core.designsystem.theme.TerningTheme

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TerningTopAppBar(
fun TerningBasicTopAppBar(
title: String = "",
showBackButton: Boolean = false,
actions: List<@Composable () -> Unit> = emptyList(),
Expand All @@ -26,7 +26,7 @@ fun TerningTopAppBar(
Text(
text = title,
textAlign = TextAlign.Center,
style = TerningTypography().title2
style = TerningTheme.typography.title2
)

},
Expand All @@ -50,4 +50,4 @@ fun TerningTopAppBar(
}
},
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.terning.core.designsystem.textfield

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.Grey500
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun NameTextField(
text: String,
onValueChange: (String) -> Unit,
hint: String,
helperMessage: String,
helperIcon: Int? = null,
helperColor: Color = TerningMain,
) {
TerningBasicTextField(
value = text,
onValueChange = onValueChange,
textStyle = TerningTheme.typography.detail1,
textColor = Black,
drawLineColor = Grey500,
cursorBrush = SolidColor(Grey400),
hint = hint,
hintColor = Grey300,
showTextLength = true,
maxTextLength = 12,
helperMessage = helperMessage,
helperIcon = helperIcon,
helperColor = helperColor,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.terning.core.designsystem.textfield

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.SolidColor
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun SearchTextField(
text: String,
onValueChange: (String) -> Unit,
hint: String,
leftIcon: Int,
) {
// TerningBasicTextField(
// value = text,
// onValueChange = onValueChange,
// textStyle = TerningTheme.typography.button3,
// textColor = Grey400,
// cursorBrush = SolidColor(Grey300),
// drawLineColor = Grey300,
// strokeWidth = 2f,
// hint = hint,
// hintColor = Grey300,
// leftIcon = leftIcon,
// leftIconColor = Grey400,
// )
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package com.terning.core.designsystem.textfield

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
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.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White

@Composable
fun TerningBasicTextField(
value: String,
onValueChange: (String) -> Unit,
textStyle: TextStyle,
textColor: Color,
hintColor: Color,
drawLineColor: Color,
helperColor: Color,
cursorBrush: Brush,
strokeWidth: Float = 1f,
leftIcon: Int? = null,
leftIconColor: Color = TerningMain,
maxTextLength: Int? = null,
showTextLength: Boolean = false,
hint: String = "",
helperMessage: String = "",
helperIcon: Int? = null,
) {
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current

BasicTextField(value = value,
onValueChange = onValueChange,
singleLine = true,
maxLines = 1,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = {
keyboardController?.hide()
focusManager.clearFocus()
}),

modifier = Modifier
.fillMaxWidth()
.background(White)
.drawWithContent {
val canvasWidth = size.width
val canvasHeight = size.height

drawContent()
drawLine(
color = drawLineColor,
start = Offset(x = 0f, y = canvasHeight),
end = Offset(x = canvasWidth, y = canvasHeight),
strokeWidth = strokeWidth.dp.toPx(),
)
},

textStyle = textStyle.copy(color = textColor),
cursorBrush = cursorBrush,

decorationBox = { innerTextField ->
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.padding(vertical = 8.dp)
) {
leftIcon?.let {
Icon(
painter = painterResource(id = it),
contentDescription = null,
tint = leftIconColor,
)
}
Box(modifier = Modifier.weight(1f)) {
if (value.isEmpty()) {
Text(
text = hint,
style = textStyle,
color = hintColor
)
}
innerTextField()
}
if (showTextLength && maxTextLength != null) {
Text(
text = "${value.length}/$maxTextLength",
style = TerningTheme.typography.button3,
color = Grey300,
)
}
}
})

Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier.padding(vertical = 8.dp)
) {
helperIcon?.let {
Icon(
painter = painterResource(id = it),
contentDescription = null,
tint = helperColor,
)
}
Text(
text = helperMessage,
style = TerningTheme.typography.detail3,
color = helperColor,
)
}
}
6 changes: 6 additions & 0 deletions core/src/main/java/com/terning/core/extension/LocalDateExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.terning.core.extension

import java.time.LocalDate

fun LocalDate.getStringAsTitle(): String =
"${year}๋…„ ${monthValue.toString().padStart(2, '0')}์›”"
3 changes: 3 additions & 0 deletions feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ dependencies {

// Compose Preview
debugImplementation(libs.compose.ui.tooling)
// //Compose Preview
// implementation(libs.androidx.compose.ui.tooling)
// implementation(libs.androidx.compose.ui.tooling.preview)

// KakaoDependencies
implementation(libs.kakao.user)
Expand Down
Loading

0 comments on commit 6cb7ff2

Please sign in to comment.