Skip to content

Commit

Permalink
[REFACTOR/#19] 타이포 테마 적용 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jul 8, 2024
1 parent 8cd0618 commit 1064dd8
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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.TerningTypography
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun NameTextField(
Expand All @@ -19,10 +19,10 @@ fun NameTextField(
helperIcon: Int? = null,
helperColor: Color = TerningMain,
) {
TerningTextField(
TerningBasicTextField(
value = text,
onValueChange = onValueChange,
textStyle = TerningTypography().detail1,
textStyle = TerningTheme.typography.detail1,
textColor = Black,
drawLineColor = Grey500,
cursorBrush = SolidColor(Grey400),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.TerningTypography
import com.terning.core.designsystem.theme.TerningTheme

@Composable
fun SearchTextField(
Expand All @@ -13,10 +13,10 @@ fun SearchTextField(
hint: String,
leftIcon: Int,
) {
TerningTextField(
TerningBasicTextField(
value = text,
onValueChange = onValueChange,
textStyle = TerningTypography().button3,
textStyle = TerningTheme.typography.button3,
textColor = Grey400,
cursorBrush = SolidColor(Grey300),
drawLineColor = Grey300,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ 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.TerningTypography
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White

@Composable
fun TerningTextField(
fun TerningBasicTextField(
value: String,
onValueChange: (String) -> Unit,
textStyle: TextStyle,
Expand All @@ -52,17 +52,15 @@ fun TerningTextField(
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current

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

modifier = Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -99,23 +97,20 @@ fun TerningTextField(
Box(modifier = Modifier.weight(1f)) {
if (value.isEmpty()) {
Text(
text = hint,
style = textStyle,
color = hintColor
text = hint, style = textStyle, color = hintColor
)
}
innerTextField()
}
if (showTextLength && maxTextLength != null) {
Text(
text = "${value.length}/$maxTextLength",
style = TerningTypography().button3,
style = TerningTheme.typography.button3,
color = Grey300,
)
}
}
}
)
})

Row(
verticalAlignment = Alignment.CenterVertically,
Expand All @@ -131,7 +126,7 @@ fun TerningTextField(
}
Text(
text = helperMessage,
style = TerningTypography().detail3,
style = TerningTheme.typography.detail3,
color = helperColor,
)
}
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
@@ -1,24 +1,20 @@
package com.terning.core.designsystem.topappbar

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
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.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 @@ -30,7 +26,7 @@ fun TerningTopAppBar(
Text(
text = title,
textAlign = TextAlign.Center,
style = TerningTypography().title2
style = TerningTheme.typography.title2
)

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.navigation.navOptions
import com.terning.feature.calendar.navigation.navigateCalendar
import com.terning.feature.home.navigation.navigateHome
import com.terning.feature.mypage.navigation.navigateMyPage
import com.terning.feature.onboarding.signin.navigation.SignIn
import com.terning.feature.search.navigation.Search
import com.terning.feature.search.navigation.navigateSearch

Expand All @@ -22,7 +23,7 @@ class MainNavigator(
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

val startDestination = Search
val startDestination = SignIn

val currentTab: MainTab?
@Composable get() = MainTab.find { tab ->
Expand Down
6 changes: 3 additions & 3 deletions feature/src/main/java/com/terning/feature/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.White
import com.terning.core.designsystem.topappbar.LogoTopAppBar
import com.terning.core.designsystem.topappbar.MyPageTopAppBar
import com.terning.core.designsystem.topappbar.TerningTopAppBar
import com.terning.core.designsystem.topappbar.TerningBasicTopAppBar
import com.terning.feature.calendar.navigation.calendarNavGraph
import com.terning.feature.home.navigation.homeNavGraph
import com.terning.feature.mypage.navigation.myPageNavGraph
Expand All @@ -41,10 +41,10 @@ fun MainScreen(
topBar = {
when (navigator.currentTab) {
MainTab.HOME -> LogoTopAppBar()
MainTab.CALENDAR -> TerningTopAppBar()
MainTab.CALENDAR -> TerningBasicTopAppBar()
MainTab.SEARCH -> LogoTopAppBar()
MainTab.MY_PAGE -> MyPageTopAppBar()
null -> TerningTopAppBar()
null -> TerningBasicTopAppBar()
}
},
bottomBar = {
Expand Down

0 comments on commit 1064dd8

Please sign in to comment.