Skip to content

Commit fe76fa4

Browse files
committed
refactor: 리뷰 반영 — 텍스트 스타일 일원화, sp→dp 전환, 네이밍 변경
- RunnectTextStyles 도입: fontFamily+fontWeight+fontSize를 하나의 스타일로 관리 - CompositionLocal로 RunnectTheme.textStyle 접근 제공 - sp → dp.value.sp로 시스템 폰트 크기 영향 제거 - 네이밍: small/medium/large → bold20, semiBold15 등 weight+size 기반 - MyPageScreen, VisitorModeScreen의 모든 Text를 style = textStyle.xxx로 통일
1 parent 506d53e commit fe76fa4

4 files changed

Lines changed: 88 additions & 77 deletions

File tree

app/src/main/java/com/runnect/runnect/presentation/mypage/MyPageScreen.kt

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ import androidx.compose.ui.Modifier
3333
import androidx.compose.ui.draw.clip
3434
import androidx.compose.ui.res.painterResource
3535
import androidx.compose.ui.res.stringResource
36-
import androidx.compose.ui.text.font.FontWeight
3736
import androidx.compose.ui.unit.dp
38-
import androidx.compose.ui.unit.sp
3937
import coil3.compose.AsyncImage
4038
import com.runnect.runnect.R
4139
import com.runnect.runnect.presentation.ui.theme.G1
@@ -44,7 +42,7 @@ import com.runnect.runnect.presentation.ui.theme.G3
4442
import com.runnect.runnect.presentation.ui.theme.G4
4543
import com.runnect.runnect.presentation.ui.theme.M1
4644
import com.runnect.runnect.presentation.ui.theme.M3
47-
import com.runnect.runnect.presentation.ui.theme.PretendardFontFamily
45+
import com.runnect.runnect.presentation.ui.theme.RunnectTheme
4846

4947
@Composable
5048
fun MyPageScreen(
@@ -112,6 +110,7 @@ fun MyPageScreen(
112110

113111
@Composable
114112
private fun MyPageToolbar() {
113+
val textStyle = RunnectTheme.textStyle
115114
Box(
116115
modifier = Modifier
117116
.fillMaxWidth()
@@ -121,9 +120,7 @@ private fun MyPageToolbar() {
121120
) {
122121
Text(
123122
text = stringResource(R.string.my_page_title),
124-
fontFamily = PretendardFontFamily,
125-
fontWeight = FontWeight.Bold,
126-
fontSize = 20.sp,
123+
style = textStyle.bold20,
127124
color = G1
128125
)
129126
}
@@ -135,6 +132,7 @@ private fun ProfileSection(
135132
profileImgResId: Int,
136133
onEditClick: () -> Unit
137134
) {
135+
val textStyle = RunnectTheme.textStyle
138136
Row(
139137
modifier = Modifier
140138
.fillMaxWidth()
@@ -150,9 +148,7 @@ private fun ProfileSection(
150148
Spacer(modifier = Modifier.width(10.dp))
151149
Text(
152150
text = nickname,
153-
fontFamily = PretendardFontFamily,
154-
fontWeight = FontWeight.Bold,
155-
fontSize = 17.sp,
151+
style = textStyle.bold17,
156152
color = M1
157153
)
158154
Spacer(modifier = Modifier.weight(1f))
@@ -171,9 +167,7 @@ private fun ProfileSection(
171167
Spacer(modifier = Modifier.width(4.dp))
172168
Text(
173169
text = stringResource(R.string.my_page_edit),
174-
fontFamily = PretendardFontFamily,
175-
fontWeight = FontWeight.Medium,
176-
fontSize = 12.sp,
170+
style = textStyle.medium12,
177171
color = M1
178172
)
179173
}
@@ -185,6 +179,7 @@ private fun LevelProgressSection(
185179
level: String,
186180
levelPercent: Int
187181
) {
182+
val textStyle = RunnectTheme.textStyle
188183
val clampedPercent = levelPercent.coerceIn(0, 100)
189184

190185
Column(
@@ -196,16 +191,12 @@ private fun LevelProgressSection(
196191
Row {
197192
Text(
198193
text = stringResource(R.string.my_page_lv_indicator),
199-
fontFamily = PretendardFontFamily,
200-
fontWeight = FontWeight.Bold,
201-
fontSize = 15.sp,
194+
style = textStyle.bold15,
202195
color = G1
203196
)
204197
Text(
205198
text = level,
206-
fontFamily = PretendardFontFamily,
207-
fontWeight = FontWeight.Bold,
208-
fontSize = 15.sp,
199+
style = textStyle.bold15,
209200
color = G1
210201
)
211202
}
@@ -226,16 +217,12 @@ private fun LevelProgressSection(
226217
) {
227218
Text(
228219
text = clampedPercent.toString(),
229-
fontFamily = PretendardFontFamily,
230-
fontWeight = FontWeight.SemiBold,
231-
fontSize = 13.sp,
220+
style = textStyle.semiBold13,
232221
color = G1
233222
)
234223
Text(
235224
text = stringResource(R.string.my_page_progress_max),
236-
fontFamily = PretendardFontFamily,
237-
fontWeight = FontWeight.SemiBold,
238-
fontSize = 13.sp,
225+
style = textStyle.semiBold13,
239226
color = G2
240227
)
241228
}
@@ -281,6 +268,7 @@ private fun MenuItem(
281268
onClick: () -> Unit,
282269
showDivider: Boolean = true
283270
) {
271+
val textStyle = RunnectTheme.textStyle
284272
Column {
285273
Row(
286274
modifier = Modifier
@@ -297,9 +285,7 @@ private fun MenuItem(
297285
Spacer(modifier = Modifier.width(8.dp))
298286
Text(
299287
text = title,
300-
fontFamily = PretendardFontFamily,
301-
fontWeight = FontWeight.Medium,
302-
fontSize = 15.sp,
288+
style = textStyle.medium15,
303289
color = G1
304290
)
305291
Spacer(modifier = Modifier.weight(1f))
@@ -317,6 +303,7 @@ private fun MenuItem(
317303

318304
@Composable
319305
private fun VersionSection() {
306+
val textStyle = RunnectTheme.textStyle
320307
Row(
321308
modifier = Modifier
322309
.fillMaxWidth()
@@ -327,16 +314,12 @@ private fun VersionSection() {
327314
) {
328315
Text(
329316
text = stringResource(R.string.my_page_version_title),
330-
fontFamily = PretendardFontFamily,
331-
fontWeight = FontWeight.Medium,
332-
fontSize = 15.sp,
317+
style = textStyle.medium15,
333318
color = G2
334319
)
335320
Text(
336321
text = stringResource(R.string.my_page_version),
337-
fontFamily = PretendardFontFamily,
338-
fontWeight = FontWeight.Normal,
339-
fontSize = 14.sp,
322+
style = textStyle.regular14,
340323
color = G2
341324
)
342325
}

app/src/main/java/com/runnect/runnect/presentation/mypage/VisitorModeScreen.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ import androidx.compose.ui.Alignment
1717
import androidx.compose.ui.Modifier
1818
import androidx.compose.ui.res.painterResource
1919
import androidx.compose.ui.res.stringResource
20-
import androidx.compose.ui.text.font.FontWeight
2120
import androidx.compose.ui.text.style.TextAlign
2221
import androidx.compose.ui.unit.dp
2322
import androidx.compose.ui.unit.sp
2423
import com.runnect.runnect.R
2524
import com.runnect.runnect.presentation.ui.theme.G2
2625
import com.runnect.runnect.presentation.ui.theme.M1
27-
import com.runnect.runnect.presentation.ui.theme.PretendardFontFamily
26+
import com.runnect.runnect.presentation.ui.theme.RunnectTheme
2827
import com.runnect.runnect.presentation.ui.theme.White
2928

3029
@Composable
3130
fun VisitorModeScreen(
3231
onSignUpClick: () -> Unit
3332
) {
33+
val textStyle = RunnectTheme.textStyle
3434
Column(
3535
modifier = Modifier.fillMaxSize(),
3636
horizontalAlignment = Alignment.CenterHorizontally,
@@ -43,9 +43,7 @@ fun VisitorModeScreen(
4343
Spacer(modifier = Modifier.height(13.dp))
4444
Text(
4545
text = stringResource(R.string.visitor_mode_mypage_message),
46-
fontFamily = PretendardFontFamily,
47-
fontWeight = FontWeight.Medium,
48-
fontSize = 13.sp,
46+
style = textStyle.medium13,
4947
color = G2,
5048
textAlign = TextAlign.Center,
5149
lineHeight = 18.sp
@@ -62,9 +60,7 @@ fun VisitorModeScreen(
6260
) {
6361
Text(
6462
text = stringResource(R.string.visitor_mode_signup_btn),
65-
fontFamily = PretendardFontFamily,
66-
fontWeight = FontWeight.SemiBold,
67-
fontSize = 15.sp,
63+
style = textStyle.semiBold15,
6864
color = White
6965
)
7066
}

app/src/main/java/com/runnect/runnect/presentation/ui/theme/Theme.kt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.runnect.runnect.presentation.ui.theme
33
import androidx.compose.material3.MaterialTheme
44
import androidx.compose.material3.lightColorScheme
55
import androidx.compose.runtime.Composable
6+
import androidx.compose.runtime.CompositionLocalProvider
7+
import androidx.compose.runtime.ReadOnlyComposable
68

79
private val RunnectColorScheme = lightColorScheme(
810
primary = M1,
@@ -29,9 +31,19 @@ private val RunnectColorScheme = lightColorScheme(
2931
fun RunnectTheme(
3032
content: @Composable () -> Unit
3133
) {
32-
MaterialTheme(
33-
colorScheme = RunnectColorScheme,
34-
typography = RunnectTypography,
35-
content = content
36-
)
34+
CompositionLocalProvider(
35+
LocalRunnectTextStyles provides RunnectTextStyles()
36+
) {
37+
MaterialTheme(
38+
colorScheme = RunnectColorScheme,
39+
content = content
40+
)
41+
}
42+
}
43+
44+
object RunnectTheme {
45+
val textStyle: RunnectTextStyles
46+
@Composable
47+
@ReadOnlyComposable
48+
get() = LocalRunnectTextStyles.current
3749
}
Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.runnect.runnect.presentation.ui.theme
22

3-
import androidx.compose.material3.Typography
3+
import androidx.compose.runtime.Immutable
4+
import androidx.compose.runtime.staticCompositionLocalOf
45
import androidx.compose.ui.text.TextStyle
56
import androidx.compose.ui.text.font.Font
67
import androidx.compose.ui.text.font.FontFamily
78
import androidx.compose.ui.text.font.FontWeight
9+
import androidx.compose.ui.unit.dp
810
import androidx.compose.ui.unit.sp
911
import com.runnect.runnect.R
1012

@@ -20,65 +22,83 @@ val PretendardFontFamily = FontFamily(
2022
Font(R.font.pretendard_black, FontWeight.Black),
2123
)
2224

23-
val RunnectTypography = Typography(
24-
displayLarge = TextStyle(
25+
@Immutable
26+
data class RunnectTextStyles(
27+
val bold28: TextStyle = TextStyle(
2528
fontFamily = PretendardFontFamily,
2629
fontWeight = FontWeight.Bold,
27-
fontSize = 28.sp,
30+
fontSize = 28.dp.value.sp,
2831
),
29-
headlineLarge = TextStyle(
32+
val bold22: TextStyle = TextStyle(
3033
fontFamily = PretendardFontFamily,
3134
fontWeight = FontWeight.Bold,
32-
fontSize = 22.sp,
35+
fontSize = 22.dp.value.sp,
3336
),
34-
headlineMedium = TextStyle(
37+
val bold20: TextStyle = TextStyle(
3538
fontFamily = PretendardFontFamily,
3639
fontWeight = FontWeight.Bold,
37-
fontSize = 20.sp,
40+
fontSize = 20.dp.value.sp,
3841
),
39-
titleLarge = TextStyle(
42+
val bold17: TextStyle = TextStyle(
4043
fontFamily = PretendardFontFamily,
41-
fontWeight = FontWeight.SemiBold,
42-
fontSize = 17.sp,
44+
fontWeight = FontWeight.Bold,
45+
fontSize = 17.dp.value.sp,
4346
),
44-
titleMedium = TextStyle(
47+
val bold15: TextStyle = TextStyle(
4548
fontFamily = PretendardFontFamily,
46-
fontWeight = FontWeight.SemiBold,
47-
fontSize = 15.sp,
49+
fontWeight = FontWeight.Bold,
50+
fontSize = 15.dp.value.sp,
4851
),
49-
titleSmall = TextStyle(
52+
val semiBold17: TextStyle = TextStyle(
5053
fontFamily = PretendardFontFamily,
5154
fontWeight = FontWeight.SemiBold,
52-
fontSize = 13.sp,
55+
fontSize = 17.dp.value.sp,
5356
),
54-
bodyLarge = TextStyle(
57+
val semiBold15: TextStyle = TextStyle(
5558
fontFamily = PretendardFontFamily,
56-
fontWeight = FontWeight.Normal,
57-
fontSize = 16.sp,
59+
fontWeight = FontWeight.SemiBold,
60+
fontSize = 15.dp.value.sp,
5861
),
59-
bodyMedium = TextStyle(
62+
val semiBold13: TextStyle = TextStyle(
6063
fontFamily = PretendardFontFamily,
61-
fontWeight = FontWeight.Normal,
62-
fontSize = 14.sp,
64+
fontWeight = FontWeight.SemiBold,
65+
fontSize = 13.dp.value.sp,
6366
),
64-
bodySmall = TextStyle(
67+
val medium15: TextStyle = TextStyle(
6568
fontFamily = PretendardFontFamily,
66-
fontWeight = FontWeight.Normal,
67-
fontSize = 12.sp,
69+
fontWeight = FontWeight.Medium,
70+
fontSize = 15.dp.value.sp,
6871
),
69-
labelLarge = TextStyle(
72+
val medium14: TextStyle = TextStyle(
7073
fontFamily = PretendardFontFamily,
7174
fontWeight = FontWeight.Medium,
72-
fontSize = 14.sp,
75+
fontSize = 14.dp.value.sp,
7376
),
74-
labelMedium = TextStyle(
77+
val medium13: TextStyle = TextStyle(
7578
fontFamily = PretendardFontFamily,
7679
fontWeight = FontWeight.Medium,
77-
fontSize = 12.sp,
80+
fontSize = 13.dp.value.sp,
7881
),
79-
labelSmall = TextStyle(
82+
val medium12: TextStyle = TextStyle(
8083
fontFamily = PretendardFontFamily,
8184
fontWeight = FontWeight.Medium,
82-
fontSize = 11.sp,
85+
fontSize = 12.dp.value.sp,
86+
),
87+
val regular16: TextStyle = TextStyle(
88+
fontFamily = PretendardFontFamily,
89+
fontWeight = FontWeight.Normal,
90+
fontSize = 16.dp.value.sp,
91+
),
92+
val regular14: TextStyle = TextStyle(
93+
fontFamily = PretendardFontFamily,
94+
fontWeight = FontWeight.Normal,
95+
fontSize = 14.dp.value.sp,
96+
),
97+
val regular12: TextStyle = TextStyle(
98+
fontFamily = PretendardFontFamily,
99+
fontWeight = FontWeight.Normal,
100+
fontSize = 12.dp.value.sp,
83101
),
84102
)
103+
104+
val LocalRunnectTextStyles = staticCompositionLocalOf { RunnectTextStyles() }

0 commit comments

Comments
 (0)