Skip to content
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

HomeTopBar App Title 이미지에서 텍스트로 교체 #146

Merged
merged 4 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ val pretendard = FontFamily(
Font(R.font.pretendard_semi_bold, FontWeight.SemiBold, FontStyle.Normal),
Font(R.font.pretendard_thin, FontWeight.Thin, FontStyle.Normal),
)

val neurimboGothicRegular = FontFamily(
Font(R.font.neurimbo_gothic_regular, FontWeight.Normal, FontStyle.Normal),
)

val koronaOneRegular = FontFamily(
Font(R.font.krona_one_regular, FontWeight.Normal, FontStyle.Normal),
)
9 changes: 0 additions & 9 deletions core/designsystem/src/main/res/drawable/ic_app_title.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.TextUnit
Expand All @@ -17,6 +18,7 @@ fun FixedSizeText(
color: Color,
fontSize: TextUnit,
fontWeight: FontWeight,
fontFamily: FontFamily = pretendard,
letterSpacing: TextUnit = TextUnit.Unspecified,
textAlign: TextAlign? = null,
lineHeight: TextUnit = TextUnit.Unspecified,
Expand All @@ -27,7 +29,7 @@ fun FixedSizeText(
color = color,
fontSize = fontSize.nonScaleSp,
fontWeight = fontWeight,
fontFamily = pretendard,
fontFamily = fontFamily,
letterSpacing = letterSpacing.nonScaleSp,
textAlign = textAlign,
lineHeight = lineHeight.nonScaleSp,
Expand Down
4 changes: 2 additions & 2 deletions core/ui/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<string name="home_sub_cell">Sub Goal</string>

<!-- HomeTopbar.kt -->
<string name="bandalart">BANDALART</string>
<string name="home_list">List</string>
<string name="home_add">Add</string>

Expand Down Expand Up @@ -113,7 +114,6 @@
<string name="share_descrption">Share Icon</string>
<string name="add_descrption">Add Icon</string>
<string name="complete_descrption">Complete Icon</string>
<string name="app_descrption">App Title</string>
<string name="hamburger_descrption">Hamburger Icon</string>
<string name="clear_descrption">Clear Icon</string>
<string name="delete_descrption">Delete Icon</string>
Expand All @@ -123,4 +123,4 @@
<!-- label -->
<string name="skeleton_trans_animate_label">Hamburger Icon</string>

</resources>
</resources>
2 changes: 1 addition & 1 deletion core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<string name="home_sub_cell">서브목표</string>

<!-- HomeTopbar.kt -->
<string name="bandalart">반다라트</string>
<string name="home_list">목록</string>
<string name="home_add">추가</string>

Expand Down Expand Up @@ -114,7 +115,6 @@
<string name="share_descrption">Share Icon</string>
<string name="add_descrption">Add Icon</string>
<string name="complete_descrption">Complete Icon</string>
<string name="app_descrption">App Title</string>
<string name="hamburger_descrption">Hamburger Icon</string>
<string name="clear_descrption">Clear Icon</string>
<string name="delete_descrption">Delete Icon</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.nexters.bandalart.android.feature.home.ui

import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import com.nexters.bandalart.android.core.designsystem.theme.Gray900
import com.nexters.bandalart.android.core.designsystem.theme.koronaOneRegular
import com.nexters.bandalart.android.core.designsystem.theme.neurimboGothicRegular
import com.nexters.bandalart.android.core.ui.R
import com.nexters.bandalart.android.core.ui.component.FixedSizeText
import java.util.Locale

@Composable
fun HomeAppTitle(
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
val currentLocale = context.getCurrentLocale()

when (currentLocale.language) {
Locale.KOREAN.language -> {
HomeAppKoreanTitle(modifier = modifier)
}

Locale.ENGLISH.language -> {
HomeAppEnglishTitle(modifier = modifier)
}

else -> {
HomeAppEnglishTitle(modifier = modifier)
}
}
}

@Composable
fun HomeAppKoreanTitle(
modifier: Modifier = Modifier,
) {
FixedSizeText(
modifier = modifier,
text = stringResource(R.string.bandalart),
color = Gray900,
fontSize = 28.sp,
fontWeight = FontWeight.W400,
fontFamily = neurimboGothicRegular,
lineHeight = 20.sp,
letterSpacing = (-0.56).sp,
)
}

@Composable
fun HomeAppEnglishTitle(
modifier: Modifier = Modifier,
) {
FixedSizeText(
modifier = modifier,
text = stringResource(R.string.bandalart),
color = Gray900,
fontSize = 18.sp,
fontWeight = FontWeight.W400,
fontFamily = koronaOneRegular,
lineHeight = 20.sp,
letterSpacing = (-0.36).sp,
)
}

// TODO core:util 모듈로 옮길 예정
fun Context.getCurrentLocale(): Locale {
return this.resources.configuration.locales.get(0)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nexters.bandalart.android.core.ui.R
import com.nexters.bandalart.android.core.ui.component.FixedSizeText
import com.nexters.bandalart.android.core.ui.extension.nonScaleSp
import com.nexters.bandalart.android.core.designsystem.theme.Gray600
import com.nexters.bandalart.android.core.designsystem.theme.White
import com.nexters.bandalart.android.core.designsystem.theme.pretendard
import com.nexters.bandalart.android.core.ui.R
import com.nexters.bandalart.android.core.ui.component.FixedSizeText
import com.nexters.bandalart.android.core.ui.extension.nonScaleSp

@Composable
internal fun HomeTopBar(
Expand All @@ -42,12 +42,10 @@ internal fun HomeTopBar(
contentAlignment = Alignment.CenterStart,
) {
Row(modifier = Modifier.fillMaxWidth()) {
Image(
painter = painterResource(com.nexters.bandalart.android.core.designsystem.R.drawable.ic_app_title),
contentDescription = stringResource(R.string.app_descrption),
HomeAppTitle(
modifier = Modifier
.align(Alignment.CenterVertically)
.padding(start = 20.dp),
.padding(start = 20.dp, top = 2.dp),
)
Spacer(modifier = Modifier.weight(1f))
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.nexters.bandalart.android.core.designsystem.theme.Gray50
import com.nexters.bandalart.android.core.designsystem.theme.Gray600
import com.nexters.bandalart.android.core.designsystem.theme.Gray900
import com.nexters.bandalart.android.core.designsystem.theme.White
import com.nexters.bandalart.android.core.designsystem.theme.neurimboGothicRegular
import com.nexters.bandalart.android.feature.home.ui.CompletionRatioProgressBar

@Composable
Expand Down Expand Up @@ -75,12 +76,17 @@ fun BandalartSkeletonScreen(
contentAlignment = Alignment.CenterStart,
) {
Row(modifier = Modifier.fillMaxWidth()) {
Image(
painter = painterResource(com.nexters.bandalart.android.core.designsystem.R.drawable.ic_app_title),
contentDescription = stringResource(R.string.app_descrption),
FixedSizeText(
modifier = Modifier
.align(Alignment.CenterVertically)
.padding(start = 20.dp),
.padding(start = 20.dp, top = 2.dp),
text = stringResource(R.string.bandalart),
color = Gray900,
fontSize = 28.sp,
fontWeight = FontWeight.W400,
fontFamily = neurimboGothicRegular,
lineHeight = 20.sp,
letterSpacing = (-0.56).sp,
)
}
}
Expand Down