diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 97337c7c..724be0a1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,4 +25,5 @@ dependencies { implementation(project(":core:network")) implementation(project(":core:datastore")) implementation(project(":core:domain")) + implementation(project(":core:designsystem")) } diff --git a/app/src/main/java/com/withpeace/withpeace/MainActivity.kt b/app/src/main/java/com/withpeace/withpeace/MainActivity.kt index 7eb479dc..a44bd222 100644 --- a/app/src/main/java/com/withpeace/withpeace/MainActivity.kt +++ b/app/src/main/java/com/withpeace/withpeace/MainActivity.kt @@ -1,28 +1,18 @@ package com.withpeace.withpeace import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.ui.Modifier -import androidx.lifecycle.lifecycleScope -import com.withpeace.withpeace.core.data.repository.DefaultTokenRepository -import com.withpeace.withpeace.core.domain.repository.TokenRepository import com.withpeace.withpeace.feature.login.LoginScreen import com.withpeace.withpeace.ui.theme.WithpeaceTheme import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.launch -import javax.inject.Inject @AndroidEntryPoint class MainActivity : ComponentActivity() { - - @Inject - lateinit var repository: TokenRepository - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { diff --git a/app/src/main/java/com/withpeace/withpeace/ui/theme/Color.kt b/app/src/main/java/com/withpeace/withpeace/ui/theme/Color.kt deleted file mode 100644 index da096639..00000000 --- a/app/src/main/java/com/withpeace/withpeace/ui/theme/Color.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.withpeace.withpeace.ui.theme - -import androidx.compose.ui.graphics.Color - -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/com/withpeace/withpeace/ui/theme/Theme.kt b/app/src/main/java/com/withpeace/withpeace/ui/theme/Theme.kt deleted file mode 100644 index 1da7c3b6..00000000 --- a/app/src/main/java/com/withpeace/withpeace/ui/theme/Theme.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.withpeace.withpeace.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.LocalView -import androidx.core.view.WindowCompat - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80, -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40, - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) - -@Composable -fun WithpeaceTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - 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) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - val view = LocalView.current - if (!view.isInEditMode) { - SideEffect { - val window = (view.context as Activity).window - window.statusBarColor = colorScheme.primary.toArgb() - WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme - } - } - - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, - content = content, - ) -} \ No newline at end of file diff --git a/app/src/main/java/com/withpeace/withpeace/ui/theme/Type.kt b/app/src/main/java/com/withpeace/withpeace/ui/theme/Type.kt deleted file mode 100644 index afec9d8a..00000000 --- a/app/src/main/java/com/withpeace/withpeace/ui/theme/Type.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.withpeace.withpeace.ui.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp, - ), - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) \ No newline at end of file diff --git a/build-logic/src/main/kotlin/convention.feature.gradle.kts b/build-logic/src/main/kotlin/convention.feature.gradle.kts index c5bbe686..756f561f 100644 --- a/build-logic/src/main/kotlin/convention.feature.gradle.kts +++ b/build-logic/src/main/kotlin/convention.feature.gradle.kts @@ -10,4 +10,5 @@ plugins { dependencies{ implementation(project(":core:data")) implementation(project(":core:domain")) + implementation(project(":core:designsystem")) } \ No newline at end of file diff --git a/core/designsystem/.gitignore b/core/designsystem/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/designsystem/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts new file mode 100644 index 00000000..d518a6ce --- /dev/null +++ b/core/designsystem/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("com.android.library") + id("convention.android.base") + id("convention.android.compose") +} + +android { + namespace = "com.withpeace.withpeace.core.designsystem" +} diff --git a/core/designsystem/consumer-rules.pro b/core/designsystem/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/core/designsystem/proguard-rules.pro b/core/designsystem/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/core/designsystem/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/designsystem/src/main/AndroidManifest.xml b/core/designsystem/src/main/AndroidManifest.xml new file mode 100644 index 00000000..8bdb7e14 --- /dev/null +++ b/core/designsystem/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt new file mode 100644 index 00000000..959735ba --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt @@ -0,0 +1,39 @@ +package com.withpeace.withpeace.core.designsystem.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) + +val mainpink = Color(0xFFFEA0A1) +val subPink = Color(0xFFF5D6DB) +val subApricot = Color(0xFFFED9C9) +val subBlue = Color(0xFFDFF2F9) + +val systemBlack = Color(0xFF212529) +val systemGray1 = Color(0xFF3D3D3D) +val systemGray2 = Color(0xFFA7A7A7) +val systemGray3 = Color(0xFFECECEF) +val systemError = Color(0xFFF0474B) +val systemSuccess = Color(0xFF3BD569) + +data class WithPeaceColor( + val MainPink: Color = mainpink, + val SubPink: Color = subPink, + val SubApricot: Color = subApricot, + val SubBlue: Color = subBlue, + val SystemBlack: Color = systemBlack, + val SystemGray1: Color = systemGray1, + val SystemGray2: Color = systemGray2, + val SystemGray3: Color = systemGray3, + val SystemError: Color = systemError, + val SystemSuccess: Color = systemSuccess, +) + +val lightColor = WithPeaceColor() +val darkColor = WithPeaceColor() diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Padding.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Padding.kt new file mode 100644 index 00000000..6323cee1 --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Padding.kt @@ -0,0 +1,9 @@ +package com.withpeace.withpeace.core.designsystem.theme + +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp + +data class WithPeacePadding( + val BasicHorizontalPadding: Dp = 24.dp, + val BasicContentPadding: Dp = 8.dp, +) diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Theme.kt new file mode 100644 index 00000000..c6dfdb62 --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Theme.kt @@ -0,0 +1,50 @@ +package com.withpeace.withpeace.core.designsystem.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.staticCompositionLocalOf + +val LocalCustomColors = + staticCompositionLocalOf { + WithPeaceColor() + } + +val LocalCustomTypography = + staticCompositionLocalOf { + WithPeaceTypography() + } +val LocalCustomPadding = + staticCompositionLocalOf { + WithPeacePadding() + } + +@Composable +fun WithpeaceTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + content: @Composable () -> Unit, +) { + val colorScheme = + when { + darkTheme -> darkColor + else -> lightColor + } + CompositionLocalProvider( + LocalCustomColors provides colorScheme, + LocalCustomTypography provides WithPeaceTypography(), + LocalCustomPadding provides WithPeacePadding(), + content = content, + ) +} + +object WithpeaceTheme { + val colors: WithPeaceColor + @Composable + get() = LocalCustomColors.current + val typography: WithPeaceTypography + @Composable + get() = LocalCustomTypography.current + val padding: WithPeacePadding + @Composable + get() = LocalCustomPadding.current +} diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Type.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Type.kt new file mode 100644 index 00000000..4a5c058c --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Type.kt @@ -0,0 +1,119 @@ +package com.withpeace.withpeace.core.designsystem.theme + +import androidx.compose.material3.Typography +import androidx.compose.runtime.Immutable +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.withpeace.withpeace.core.designsystem.R + +// Set of Material typography styles to start with +val Typography = + Typography( + bodyLarge = + TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp, + ), + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ + ) + +val PretendardFont = + FontFamily( + Font( + resId = R.font.pretendard_bold, + weight = FontWeight.Bold, + ), + Font( + resId = R.font.pretendard_regular, + weight = FontWeight.Normal, + ), + Font( + resId = R.font.pretendard_extra_bold, + weight = FontWeight.ExtraBold, + ), + Font( + resId = R.font.pretendard_extra_light, + weight = FontWeight.ExtraLight, + ), + Font( + resId = R.font.pretendard_extra_light, + weight = FontWeight.Light, + ), + Font( + resId = R.font.pretendard_medium, + weight = FontWeight.Medium, + ), + Font( + resId = R.font.pretendard_semi_bold, + weight = FontWeight.SemiBold, + ), + Font( + resId = R.font.pretendard_thin, + weight = FontWeight.Thin, + ), + ) + +@Immutable +data class WithPeaceTypography( + val heading: TextStyle = + TextStyle( + fontFamily = PretendardFont, + fontWeight = FontWeight.Bold, + fontSize = 24.sp, + lineHeight = 33.6.sp, + letterSpacing = (-0.096).sp, + ), + val title1: TextStyle = + TextStyle( + fontFamily = PretendardFont, + fontWeight = FontWeight.Bold, + fontSize = 20.sp, + lineHeight = 28.sp, + letterSpacing = (-0.08).sp, + ), + val title2: TextStyle = + TextStyle( + fontFamily = PretendardFont, + fontWeight = FontWeight.Bold, + fontSize = 18.sp, + lineHeight = 25.2.sp, + letterSpacing = (-0.4).sp, + ), + val body: TextStyle = + TextStyle( + fontFamily = PretendardFont, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 22.4.sp, + letterSpacing = (-0.4).sp, + ), + val caption: TextStyle = + TextStyle( + fontFamily = PretendardFont, + fontWeight = FontWeight.Normal, + fontSize = 14.sp, + lineHeight = 19.6.sp, + letterSpacing = (-0.4).sp, + ), +) diff --git a/core/designsystem/src/main/res/font/pretendard_black.ttf b/core/designsystem/src/main/res/font/pretendard_black.ttf new file mode 100644 index 00000000..d0c1db81 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_black.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_bold.ttf b/core/designsystem/src/main/res/font/pretendard_bold.ttf new file mode 100644 index 00000000..fb07fc65 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_bold.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_extra_bold.ttf b/core/designsystem/src/main/res/font/pretendard_extra_bold.ttf new file mode 100644 index 00000000..9d5fe072 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_extra_bold.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_extra_light.ttf b/core/designsystem/src/main/res/font/pretendard_extra_light.ttf new file mode 100644 index 00000000..09e65428 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_extra_light.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_light.ttf b/core/designsystem/src/main/res/font/pretendard_light.ttf new file mode 100644 index 00000000..2e8541d6 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_light.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_medium.ttf b/core/designsystem/src/main/res/font/pretendard_medium.ttf new file mode 100644 index 00000000..1db67c68 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_medium.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_regular.ttf b/core/designsystem/src/main/res/font/pretendard_regular.ttf new file mode 100644 index 00000000..01147e99 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_regular.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_semi_bold.ttf b/core/designsystem/src/main/res/font/pretendard_semi_bold.ttf new file mode 100644 index 00000000..9f2690f0 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_semi_bold.ttf differ diff --git a/core/designsystem/src/main/res/font/pretendard_thin.ttf b/core/designsystem/src/main/res/font/pretendard_thin.ttf new file mode 100644 index 00000000..fe9825f1 Binary files /dev/null and b/core/designsystem/src/main/res/font/pretendard_thin.ttf differ diff --git a/settings.gradle.kts b/settings.gradle.kts index 7ae33a31..f73b4e73 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,4 +22,5 @@ include(":core:network") include(":core:data") include(":core:domain") include(":core:datastore") +include(":core:designsystem") include(":core:interceptor")