Skip to content

Commit

Permalink
feat[design]: 디자인 시스템 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Jan 29, 2025
1 parent d38be91 commit afae650
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
1 change: 1 addition & 0 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
hmh("feature")
hmh("compose")
}

android {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hmh.hamyeonham.feature.lock.ui.theme
package com.hmh.hamyeonham.core.designsystem.ui.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
package com.hmh.hamyeonham.feature.lock.ui.theme
package com.hmh.hamyeonham.core.designsystem.ui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat

private val DarkColorScheme = darkColorScheme(
primary = Gray7,
secondary = Gray8,
tertiary = WhiteBtn
onPrimary = WhiteBtn,
primaryContainer = Gray8,
secondary = Gray3,
onSecondary = WhiteText,
secondaryContainer = Gray4,
onSecondaryContainer = Gray2,
background = Blackground,
onBackground = WhiteText
)


private val LightColorScheme = lightColorScheme(
primary = Gray7,
secondary = Gray8,
tertiary = WhiteBtn
onPrimary = WhiteBtn,
primaryContainer = Gray8,
secondary = Gray3,
onSecondary = WhiteText,
secondaryContainer = Gray4,
onSecondaryContainer = Gray2,
background = Blackground,
onBackground = WhiteText
)

@Composable
fun HMHAndroidTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme

darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
if (!LocalInspectionMode.current) {
val view = LocalView.current
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
WindowCompat.getInsetsController(window, view).isAppearanceLightNavigationBars =
!darkTheme
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package com.hmh.hamyeonham.feature.lock.ui.theme
package com.hmh.hamyeonham.core.designsystem.ui.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import com.hmh.hamyeonham.core.designsystem.R

val PretendardMedium = FontFamily(
Font(
com.hmh.hamyeonham.core.designsystem.R.font.pretendard_medium,
R.font.pretendard_medium,
FontWeight.Medium
)
)
val PretendardRegular = FontFamily(
Font(
com.hmh.hamyeonham.core.designsystem.R.font.pretendard_regular,
R.font.pretendard_regular,
FontWeight.Normal
)
)
val PretendardSemiBold = FontFamily(
Font(
com.hmh.hamyeonham.core.designsystem.R.font.pretendard_semibold,
R.font.pretendard_semibold,
FontWeight.SemiBold
)
)
Expand Down

0 comments on commit afae650

Please sign in to comment.