Skip to content

Commit

Permalink
Merge pull request #96 from wisemuji/feature/#73
Browse files Browse the repository at this point in the history
  • Loading branch information
wisemuji authored Jul 26, 2023
2 parents 5d518f7 + dea5129 commit 66cfb60
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun BottomLogo(color: Color = MaterialTheme.colorScheme.onSecondaryFixed) {
) {
Text(
text = "Droid Knights 2023",
style = MaterialTheme.typography.labelMedium,
style = KnightsTheme.typography.labelMediumR,
color = color,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.droidknights.app2023.core.designsystem.theme.KnightsTheme

@Composable
fun TextChip(
Expand All @@ -27,7 +28,7 @@ fun TextChip(
shape = RoundedCornerShape(10.dp),
color = containerColor,
) {
ProvideTextStyle(MaterialTheme.typography.labelMedium) {
ProvideTextStyle(KnightsTheme.typography.labelMediumR) {
Text(text = text, color = labelColor, modifier = Modifier.padding(TextChipPadding))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.droidknights.app2023.core.designsystem.theme.KnightsTheme

@Composable
fun KnightsTopAppBar(
Expand Down Expand Up @@ -68,7 +69,7 @@ fun KnightsTopAppBar(
}
Text(
text = stringResource(id = titleRes),
style = MaterialTheme.typography.titleSmall,
style = KnightsTheme.typography.titleSmallM,
modifier = Modifier.align(Alignment.Center)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,19 @@ fun KnightsTheme(
content: @Composable () -> Unit,
) {
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme
CompositionLocalProvider(LocalDarkTheme provides darkTheme) {
CompositionLocalProvider(
LocalDarkTheme provides darkTheme,
LocalTypography provides Typography
) {
MaterialTheme(
typography = Typography,
colorScheme = colorScheme,
content = content,
)
}
}

object KnightsTheme {
val typography: KnightsTypography
@Composable
get() = LocalTypography.current
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.droidknights.app2023.core.designsystem.theme

import androidx.compose.material3.Typography
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -11,100 +12,219 @@ private val SansSerifStyle = TextStyle(
fontWeight = FontWeight.Normal,
)

private val DisplayLarge = SansSerifStyle.copy(
fontSize = 57.sp,
lineHeight = 64.sp,
letterSpacing = (-0.25).sp
)

private val DisplayMedium = SansSerifStyle.copy(
fontSize = 45.sp,
lineHeight = 52.sp,
)

private val DisplaySmall = SansSerifStyle.copy(
fontSize = 36.sp,
lineHeight = 44.sp,
)

private val HeadlineLarge = SansSerifStyle.copy(
fontSize = 32.sp,
lineHeight = 40.sp,
)

private val HeadlineMedium = SansSerifStyle.copy(
fontSize = 28.sp,
lineHeight = 36.sp,
)

private val HeadlineSmall = SansSerifStyle.copy(
fontSize = 24.sp,
lineHeight = 32.sp,
fontWeight = FontWeight.W900,
)

private val TitleLarge = SansSerifStyle.copy(
fontSize = 22.sp,
lineHeight = 28.sp,
)

private val TitleMedium = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
)

private val TitleSmall = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
)

private val LabelLarge = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
)

private val LabelMedium = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
)

private val LabelSmall = SansSerifStyle.copy(
fontSize = 11.sp,
lineHeight = 16.sp,
)

private val BodyLarge = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)

private val BodyMedium = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
letterSpacing = 0.25.sp
)

private val BodySmall = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
letterSpacing = 0.4.sp
)

val Typography = Typography(
displayLarge = DisplayLarge,
displayMedium = DisplayMedium,
displaySmall = DisplaySmall,
headlineLarge = HeadlineLarge,
headlineMedium = HeadlineMedium,
headlineSmall = HeadlineSmall,
titleLarge = TitleLarge,
titleMedium = TitleMedium,
titleSmall = TitleSmall,
labelLarge = LabelLarge,
labelMedium = LabelMedium,
labelSmall = LabelSmall,
bodyLarge = BodyLarge,
bodyMedium = BodyMedium,
bodySmall = BodySmall,
)
internal val Typography = KnightsTypography(
displayLargeR = SansSerifStyle.copy(
fontSize = 57.sp,
lineHeight = 64.sp,
letterSpacing = (-0.25).sp
),
displayMediumR = SansSerifStyle.copy(
fontSize = 45.sp,
lineHeight = 52.sp,
),
displaySmallR = SansSerifStyle.copy(
fontSize = 36.sp,
lineHeight = 44.sp,
),
headlineLargeEB = SansSerifStyle.copy(
fontSize = 32.sp,
lineHeight = 40.sp,
fontWeight = FontWeight.ExtraBold
),
headlineLargeSB = SansSerifStyle.copy(
fontSize = 32.sp,
lineHeight = 40.sp,
fontWeight = FontWeight.SemiBold
),
headlineLargeR = SansSerifStyle.copy(
fontSize = 32.sp,
lineHeight = 40.sp,
),
headlineMediumB = SansSerifStyle.copy(
fontSize = 28.sp,
lineHeight = 36.sp,
fontWeight = FontWeight.Bold
),
headlineMediumM = SansSerifStyle.copy(
fontSize = 28.sp,
lineHeight = 36.sp,
fontWeight = FontWeight.Medium
),
headlineMediumR = SansSerifStyle.copy(
fontSize = 28.sp,
lineHeight = 36.sp,
),
headlineSmallBL = SansSerifStyle.copy(
fontSize = 24.sp,
lineHeight = 32.sp,
fontWeight = FontWeight.Black,
letterSpacing = (-0.2).sp
),
headlineSmallM = SansSerifStyle.copy(
fontSize = 24.sp,
lineHeight = 32.sp,
fontWeight = FontWeight.Medium
),
headlineSmallR = SansSerifStyle.copy(
fontSize = 24.sp,
lineHeight = 32.sp,
),
titleLargeBL = SansSerifStyle.copy(
fontSize = 22.sp,
lineHeight = 28.sp,
fontWeight = FontWeight.Black
),
titleLargeB = SansSerifStyle.copy(
fontSize = 22.sp,
lineHeight = 28.sp,
fontWeight = FontWeight.Bold
),
titleLargeM = SansSerifStyle.copy(
fontSize = 22.sp,
lineHeight = 28.sp,
fontWeight = FontWeight.Medium
),
titleLargeR = SansSerifStyle.copy(
fontSize = 22.sp,
lineHeight = 28.sp,
),
titleMediumBL = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
fontWeight = FontWeight.Black
),
titleMediumB = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
fontWeight = FontWeight.Bold
),
titleMediumR = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
),
titleSmallB = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
fontWeight = FontWeight.Bold
),
titleSmallM = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
fontWeight = FontWeight.Medium
),
titleSmallM140 = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 140.sp,
fontWeight = FontWeight.Medium
),
titleSmallR140 = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 140.sp,
),
titleSmallR = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
),
labelLargeM = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
fontWeight = FontWeight.Medium,
),
labelMediumR = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
),
labelSmallM = SansSerifStyle.copy(
fontSize = 11.sp,
lineHeight = 16.sp,
fontWeight = FontWeight.Medium,
),
bodyLargeR = SansSerifStyle.copy(
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
),
bodyMediumR = SansSerifStyle.copy(
fontSize = 14.sp,
lineHeight = 20.sp,
letterSpacing = 0.25.sp
),
bodySmallR = SansSerifStyle.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
letterSpacing = 0.4.sp
),
)

@Immutable
data class KnightsTypography(
val displayLargeR: TextStyle,
val displayMediumR: TextStyle,
val displaySmallR: TextStyle,

val headlineLargeEB: TextStyle,
val headlineLargeSB: TextStyle,
val headlineLargeR: TextStyle,
val headlineMediumB: TextStyle,
val headlineMediumM: TextStyle,
val headlineMediumR: TextStyle,
val headlineSmallBL: TextStyle,
val headlineSmallM: TextStyle,
val headlineSmallR: TextStyle,

val titleLargeBL: TextStyle,
val titleLargeB: TextStyle,
val titleLargeM: TextStyle,
val titleLargeR: TextStyle,
val titleMediumBL: TextStyle,
val titleMediumB: TextStyle,
val titleMediumR: TextStyle,
val titleSmallB: TextStyle,
val titleSmallM: TextStyle,
val titleSmallM140: TextStyle,
val titleSmallR: TextStyle,
val titleSmallR140: TextStyle,

val labelLargeM: TextStyle,
val labelMediumR: TextStyle,
val labelSmallM: TextStyle,

val bodyLargeR: TextStyle,
val bodyMediumR: TextStyle,
val bodySmallR: TextStyle,
)

val LocalTypography = staticCompositionLocalOf {
KnightsTypography(
labelSmallM = SansSerifStyle,
displayLargeR = SansSerifStyle,
displayMediumR = SansSerifStyle,
displaySmallR = SansSerifStyle,
headlineLargeEB = SansSerifStyle,
headlineLargeSB = SansSerifStyle,
headlineLargeR = SansSerifStyle,
headlineMediumB = SansSerifStyle,
headlineMediumM = SansSerifStyle,
headlineMediumR = SansSerifStyle,
headlineSmallBL = SansSerifStyle,
headlineSmallM = SansSerifStyle,
headlineSmallR = SansSerifStyle,
titleLargeBL = SansSerifStyle,
titleLargeB = SansSerifStyle,
titleLargeM = SansSerifStyle,
titleLargeR = SansSerifStyle,
titleMediumBL = SansSerifStyle,
titleMediumB = SansSerifStyle,
titleMediumR = SansSerifStyle,
titleSmallB = SansSerifStyle,
titleSmallM = SansSerifStyle,
titleSmallM140 = SansSerifStyle,
titleSmallR = SansSerifStyle,
titleSmallR140 = SansSerifStyle,
labelLargeM = SansSerifStyle,
labelMediumR = SansSerifStyle,
bodyLargeR = SansSerifStyle,
bodyMediumR = SansSerifStyle,
bodySmallR = SansSerifStyle,
)
}
Loading

0 comments on commit 66cfb60

Please sign in to comment.