-
Notifications
You must be signed in to change notification settings - Fork 0
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
init design system #9
Changes from 18 commits
0e6cbe3
fdb52cb
31940a5
a5cc19f
f77d3e5
4e41900
aa3dc0f
c3604b6
b0ccba5
4d07158
e308001
71c8884
f1d0aa8
b37e258
30ff117
b676a08
9fab75d
10e7711
392e6b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed | ||
plugins { | ||
alias(libs.plugins.funch.feature) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
요렇게 작성하는건 어떤가용?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 반영하겠습니다! |
||
alias(libs.plugins.funch.compose) | ||
} | ||
|
||
android { | ||
namespace = "com.moya.funch.designsystem" | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.moya.funch.theme | ||
|
||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.graphics.Color | ||
|
||
internal val Coral500 = Color(0xFFF86E6F) | ||
internal val Lemon500 = Color(0xFFFFE83B) | ||
internal val Lemon600 = Color(0xFFE1CA13) | ||
internal val Lemon900 = Color(0xFF90720A) | ||
internal val yellow500 = Color(0xFFE1B012) | ||
internal val yellow600 = Color(0xFFFFD240) | ||
internal val White = Color(0xFFFFFFFF) | ||
internal val Gray900 = Color(0xFF151515) | ||
internal val Gray800 = Color(0xFF242627) | ||
internal val Gray700 = Color(0xFF2C2C2C) | ||
internal val Gray600 = Color(0xFF363636) | ||
internal val Gray500 = Color(0xFF404040) | ||
internal val Gray400 = Color(0xFF6D6D6D) | ||
internal val Gray300 = Color(0xFF9B9B9B) | ||
|
||
@Stable | ||
class FunchColorSchema( | ||
background: Color, | ||
error: Color, | ||
white: Color, | ||
) { | ||
var background by mutableStateOf(background) | ||
private set | ||
var error by mutableStateOf(error) | ||
private set | ||
var white by mutableStateOf(white) | ||
private set | ||
|
||
fun copy(): FunchColorSchema = FunchColorSchema( | ||
background = background, | ||
error = error, | ||
white = white, | ||
) | ||
|
||
fun update(other: FunchColorSchema) { | ||
background = other.background | ||
error = other.error | ||
white = other.white | ||
} | ||
} | ||
|
||
fun funchDarkColorSchema( | ||
background: Color = Gray900, | ||
white: Color = White, | ||
error: Color = Coral500, | ||
|
||
): FunchColorSchema { | ||
return FunchColorSchema( | ||
white = white, | ||
background = background, | ||
error = error, | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.moya.funch.theme | ||
|
||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.staticCompositionLocalOf | ||
|
||
private val LocalFunchColors = staticCompositionLocalOf<FunchColorSchema> { | ||
error("No FunchColors provided") | ||
} | ||
private val LocalFunchTypography = staticCompositionLocalOf<FunchTypography> { | ||
error("No FunchTypography provided") | ||
} | ||
|
||
object FunchTheme { | ||
val colors: FunchColorSchema @Composable get() = LocalFunchColors.current | ||
val typography: FunchTypography @Composable get() = LocalFunchTypography.current | ||
} | ||
|
||
@Composable | ||
fun ProvidePophoryColorAndTypography( | ||
colors: FunchColorSchema, | ||
typography: FunchTypography, | ||
content: @Composable () -> Unit, | ||
) { | ||
val provideColors = remember { colors.copy() } | ||
provideColors.update(colors) | ||
val provideTypography = remember { typography.copy() } | ||
provideTypography.update(typography) | ||
CompositionLocalProvider( | ||
LocalFunchColors provides provideColors, LocalFunchTypography provides provideTypography, content = content | ||
) | ||
} | ||
|
||
@Composable | ||
fun FunchTheme( | ||
content: @Composable () -> Unit, | ||
) { | ||
// this version provides only dark theme | ||
val colors = funchDarkColorSchema() | ||
val typography = funchTypography() | ||
ProvidePophoryColorAndTypography(colors, typography) { | ||
MaterialTheme(content = content) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package com.moya.funch.theme | ||
|
||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
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.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.em | ||
import androidx.compose.ui.unit.sp | ||
import com.moya.funch.designsystem.R | ||
|
||
private val spoqaHanSansNeo = FontFamily( | ||
Font( | ||
R.font.spoqa_han_sans_neo_bold, | ||
FontWeight.Bold, | ||
FontStyle.Normal | ||
), | ||
Font( | ||
R.font.spoqa_han_sans_neo_medium, | ||
FontWeight.Medium, | ||
FontStyle.Normal | ||
), | ||
Font( | ||
R.font.spoqa_han_sans_neo_regular, | ||
FontWeight.Normal, | ||
FontStyle.Normal | ||
) | ||
|
||
) | ||
|
||
@Stable | ||
class FunchTypography internal constructor( | ||
t1: TextStyle, | ||
t2: TextStyle, | ||
sbt1: TextStyle, | ||
sbt2: TextStyle, | ||
b: TextStyle, | ||
caption: TextStyle, | ||
) { | ||
var t1: TextStyle by mutableStateOf(t1) | ||
private set | ||
var t2: TextStyle by mutableStateOf(t2) | ||
private set | ||
var sbt1: TextStyle by mutableStateOf(sbt1) | ||
private set | ||
var sbt2: TextStyle by mutableStateOf(sbt2) | ||
private set | ||
var b: TextStyle by mutableStateOf(b) | ||
private set | ||
var caption: TextStyle by mutableStateOf(caption) | ||
private set | ||
|
||
fun copy( | ||
t1: TextStyle = this.t1, | ||
t2: TextStyle = this.t2, | ||
sbt1: TextStyle = this.sbt1, | ||
sbt2: TextStyle = this.sbt2, | ||
b: TextStyle = this.b, | ||
caption: TextStyle = this.caption, | ||
): FunchTypography = FunchTypography( | ||
t1 = t1, | ||
t2 = t2, | ||
sbt1 = sbt1, | ||
sbt2 = sbt2, | ||
b = b, | ||
caption = caption, | ||
) | ||
|
||
fun update(other: FunchTypography) { | ||
t1 = other.t1 | ||
t2 = other.t2 | ||
sbt1 = other.sbt1 | ||
sbt2 = other.sbt2 | ||
b = other.b | ||
caption = other.caption | ||
} | ||
} | ||
|
||
fun funchTypography(): FunchTypography { | ||
return FunchTypography( | ||
t1 = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Bold, | ||
fontSize = 22.sp, | ||
letterSpacing = (-0.02).em, | ||
lineHeight = 28.6.sp | ||
), | ||
t2 = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Bold, | ||
fontSize = 20.sp, | ||
letterSpacing = (-0.02).em, | ||
lineHeight = 26.sp | ||
), | ||
sbt1 = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Medium, | ||
fontSize = 18.sp, | ||
letterSpacing = (-0.02).em, | ||
lineHeight = 23.4.sp | ||
), | ||
sbt2 = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Medium, | ||
fontSize = 16.sp, | ||
letterSpacing = (-0.02).sp, | ||
lineHeight = 20.8.sp | ||
), | ||
b = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 14.sp, | ||
letterSpacing = (-0.03).em, | ||
lineHeight = 21.sp | ||
), | ||
caption = TextStyle( | ||
fontFamily = spoqaHanSansNeo, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 12.sp, | ||
letterSpacing = (-0.03).em, | ||
lineHeight = 18.sp | ||
) | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Suppress("DSL_SCOPE_VIOLATION")
요구문은 찾아보니까 그래들 8.2이상이면 필요 없다고 합니다~! 링크There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이거 빼는걸 깜빡했네유 반영하겠습니다!