Skip to content

Commit

Permalink
Merge pull request #119 from THT-Team/fix/TOP-84_signup_design_qa
Browse files Browse the repository at this point in the history
TOP-84 Design 회원가입 디자인 QA 반영
  • Loading branch information
cwj-c authored Feb 10, 2024
2 parents 7e4e914 + d365793 commit 775f146
Show file tree
Hide file tree
Showing 100 changed files with 2,675 additions and 1,752 deletions.
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">THT</string>
<string name="app_name">폴링</string>
<string name="tab_tohot">투핫</string>
<string name="tab_heart">하트</string>
<string name="tab_chat">채팅</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.example.compose_ui.component.font

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.text.PlatformTextStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
Expand All @@ -22,13 +25,25 @@ val pretendardFontFamily = FontFamily(
)

@Composable
fun pretendardFontStyle(
fun rememberPretendardFontStyle(
fontWeight: FontWeight,
fontSize: TextUnit,
shadow: Shadow? = null
) = TextStyle(
fontFamily = pretendardFontFamily,
fontWeight = fontWeight,
fontSize = fontSize,
shadow = shadow
)
lineHeight: TextUnit = TextUnit.Unspecified,
color: Color = Color.Unspecified,
shadow: Shadow? = null,
includeFontPadding: Boolean = false
): TextStyle {
return remember {
TextStyle(
color = color,
fontFamily = pretendardFontFamily,
fontWeight = fontWeight,
fontSize = fontSize,
shadow = shadow,
lineHeight = lineHeight,
platformStyle = PlatformTextStyle(
includeFontPadding = includeFontPadding
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import androidx.compose.ui.unit.dp
@Composable
fun ThtCircularProgress(
modifier: Modifier = Modifier,
color: Color,
dataLoading: () -> Boolean = { false }
visible: Boolean,
color: Color
) {
if (dataLoading()) {
if (visible) {
CircularProgressIndicator(
modifier = modifier,
color = color,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,55 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.TextUnit
import com.example.compose_ui.component.font.pretendardFontStyle
import com.example.compose_ui.component.font.rememberPretendardFontStyle

@Composable
fun ThtText(
modifier: Modifier = Modifier,
textAlign: TextAlign,
text: String,
fontWeight: FontWeight,
textSize: TextUnit,
color: Color,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Center,
lineHeight: TextUnit = TextUnit.Unspecified
) {
Text(
modifier = modifier,
textAlign = textAlign,
text = text,
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = textSize,
lineHeight = lineHeight
),
color = color,
)
}

@Composable
fun ThtText(
annotatedString: AnnotatedString,
fontWeight: FontWeight,
textSize: TextUnit,
color: Color,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Center,
lineHeight: TextUnit = TextUnit.Unspecified,
includeFontPadding: Boolean = false
) {
Text(
modifier = modifier,
textAlign = textAlign,
style = pretendardFontStyle(
text = annotatedString,
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize =textSize
fontSize = textSize,
lineHeight = lineHeight,
includeFontPadding = includeFontPadding
),
color = color,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.example.compose_ui.component.text

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import tht.core.ui.R

@Composable
fun ThtTextField(
value: String,
onValueChange: (String) -> Unit,
placeholder: String,
singleLine: Boolean = false,
modifier: Modifier = Modifier,
onClear: (() -> Unit)? = null,
cursorBrush: Brush = SolidColor(Color.White),
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
textColor: ThtTextFieldColor = ThtTextFieldColor.default(),
textStyle: TextStyle = LocalTextStyle.current,
placeholderTextStyle: TextStyle = LocalTextStyle.current
) {
Row {
Box(
modifier = modifier // weight(1f) 해줘여 clear 버튼 노출됨
) {
Text(
modifier = Modifier
.fillMaxWidth()
.alpha(if (value.isEmpty()) 100f else 0f),
text = placeholder,
style = placeholderTextStyle.copy(
color = textColor.placeHolder,
fontWeight = FontWeight.SemiBold
)
)
BasicTextField(
modifier = Modifier
.fillMaxWidth(),
value = value,
cursorBrush = cursorBrush,
onValueChange = onValueChange,
textStyle = textStyle.copy(
color = textColor.text,
fontWeight = FontWeight.SemiBold
),
singleLine = singleLine,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions
)
}

if (onClear != null && value.isNotEmpty()) {
Image(
modifier = Modifier
.align(Alignment.CenterVertically)
.clickable(true, onClick = onClear),
painter = painterResource(id = com.example.compose_ui.R.drawable.ic_delete),
contentDescription = "ic_delete"
)
}
}
}

@Immutable
data class ThtTextFieldColor(
val placeHolder: Color,
val text: Color
) {
companion object {
@Composable
fun default(): ThtTextFieldColor {
return ThtTextFieldColor(
placeHolder = colorResource(id = R.color.gray_8d8d8d),
text = colorResource(id = R.color.yellow_f9cc2e),
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.example.compose_ui.component.text

import androidx.compose.animation.AnimatedVisibility
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.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Divider
import androidx.compose.material.LocalTextStyle
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp

@Composable
fun ThtTextFieldLayout(
value: String,
onValueChange: (String) -> Unit,
placeholder: String,
underLineColor: Color,
modifier: Modifier = Modifier,
singleLine: Boolean = false,
onClear: (() -> Unit)? = null,
cursorBrush: Brush = SolidColor(Color.White),
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
textColor: ThtTextFieldColor = ThtTextFieldColor.default(),
textStyle: TextStyle = LocalTextStyle.current,
placeholderTextStyle: TextStyle = LocalTextStyle.current,
focusRequester: FocusRequester = FocusRequester(),
errorVisible: Boolean = false,
error: @Composable (() -> Unit)? = null
) {
Column {
ThtTextField(
onClear = onClear,
modifier = modifier.focusRequester(focusRequester).weight(1f),
cursorBrush = cursorBrush,
value = value,
onValueChange = onValueChange,
placeholder = placeholder,
singleLine = singleLine,
placeholderTextStyle = placeholderTextStyle.copy(
color = textColor.placeHolder,
fontWeight = FontWeight.SemiBold
),
textStyle = textStyle.copy(
color = textColor.text,
fontWeight = FontWeight.SemiBold
),
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions
)
Spacer(modifier = Modifier.height(4.dp))
Divider(
modifier = Modifier.fillMaxWidth(),
color = underLineColor,
thickness = 2.dp
)
AnimatedVisibility(
visible = error != null && errorVisible
) {
error?.invoke()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import com.example.compose_ui.component.font.pretendardFontStyle
import com.example.compose_ui.component.font.rememberPretendardFontStyle
import com.example.compose_ui.extensions.dpTextUnit

@Composable
Expand All @@ -16,14 +16,16 @@ fun ThtCaption1(
fontWeight: FontWeight,
color: Color,
textAlign: TextAlign = TextAlign.Center,
includeFontPadding: Boolean = false
) {
Text(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 11.dpTextUnit
fontSize = 11.dpTextUnit,
includeFontPadding = includeFontPadding
),
color = color,
)
Expand All @@ -41,7 +43,7 @@ fun ThtCaption2(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 10.dpTextUnit
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import com.example.compose_ui.component.font.pretendardFontStyle
import com.example.compose_ui.component.font.rememberPretendardFontStyle
import com.example.compose_ui.extensions.dpTextUnit


Expand All @@ -23,7 +23,7 @@ fun ThtHeadline1(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 30.dpTextUnit
),
Expand All @@ -44,7 +44,7 @@ fun ThtHeadline2(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 26.dpTextUnit,
shadow = shadow
Expand All @@ -65,7 +65,7 @@ fun ThtHeadline3(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 24.dpTextUnit
),
Expand All @@ -86,7 +86,7 @@ fun ThtHeadline4(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 19.dpTextUnit,
shadow = shadow
Expand All @@ -107,7 +107,7 @@ fun ThtHeadline5(
modifier = modifier,
textAlign = textAlign,
text = text,
style = pretendardFontStyle(
style = rememberPretendardFontStyle(
fontWeight = fontWeight,
fontSize = 17.dpTextUnit,
),
Expand Down
Loading

0 comments on commit 775f146

Please sign in to comment.