From 5cef1ed19caa95ae41baf83912de0abb6c8f837f Mon Sep 17 00:00:00 2001 From: imashnake0 Date: Sat, 24 Feb 2024 03:41:58 -0500 Subject: [PATCH] Create `animiteBlockQuoteStyle ` --- .../animite/core/extensions/Material3Ext.kt | 13 ++++--------- gradle/libs.versions.toml | 2 +- .../com/imashnake/animite/profile/ProfileScreen.kt | 9 ++++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/core/src/main/kotlin/com/imashnake/animite/core/extensions/Material3Ext.kt b/core/src/main/kotlin/com/imashnake/animite/core/extensions/Material3Ext.kt index fc8b55f0..88a5023d 100644 --- a/core/src/main/kotlin/com/imashnake/animite/core/extensions/Material3Ext.kt +++ b/core/src/main/kotlin/com/imashnake/animite/core/extensions/Material3Ext.kt @@ -1,11 +1,11 @@ package com.imashnake.animite.core.extensions import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.Shape import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -17,18 +17,13 @@ import com.boswelja.markdown.style.BlockQuoteStyle @Composable fun animiteBlockQuoteStyle( background: Color = MaterialTheme.colorScheme.surfaceVariant, - barWidth: Dp = 2.5f.dp, + barWidth: Dp = 3.dp, barColor: Color = MaterialTheme.colorScheme.onSurfaceVariant, - barShape: Shape = CircleShape, + barShape: Shape = RectangleShape, innerPadding: PaddingValues = PaddingValues(8.dp) ) = BlockQuoteStyle( background = background, - shape = RoundedCornerShape( - topStart = barWidth/2 + innerPadding.calculateTopPadding(), - topEnd = barWidth/2 + innerPadding.calculateTopPadding(), - bottomStart = barWidth/2 + innerPadding.calculateBottomPadding(), - bottomEnd = barWidth/2 + innerPadding.calculateBottomPadding() - ), + shape = RoundedCornerShape(barWidth), barShape = barShape, barWidth = barWidth, barColor = barColor, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5e65b7ff..6e67a3fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -79,7 +79,7 @@ junit = "4.13.2" # https://github.com/detekt/detekt/releases. detekt = "1.23.4" -composeMarkdown = "1.0.1" +composeMarkdown = "1.0.3" [libraries] diff --git a/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt b/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt index c00dfa56..7599bdd5 100644 --- a/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt +++ b/profile/src/main/kotlin/com/imashnake/animite/profile/ProfileScreen.kt @@ -20,8 +20,6 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.AsyncImage import com.boswelja.markdown.material3.MarkdownDocument -import com.boswelja.markdown.material3.m3CodeBlockStyle -import com.boswelja.markdown.material3.m3TextStyleModifiers import com.boswelja.markdown.material3.m3TextStyles import com.imashnake.animite.core.extensions.animiteBlockQuoteStyle import com.imashnake.animite.core.extensions.maxHeight @@ -95,12 +93,13 @@ fun ProfileScreen( about?.let { MarkdownDocument( markdown = it, + // TODO: Fix typography and make this an `animiteTextStyle()`. textStyles = m3TextStyles().copy( - textStyle = m3TextStyles().textStyle.copy(color = textColor) + textStyle = m3TextStyles().textStyle.copy( + color = textColor + ) ), - textStyleModifiers = m3TextStyleModifiers(), blockQuoteStyle = animiteBlockQuoteStyle(), - codeBlockStyle = m3CodeBlockStyle(), modifier = contentModifier ) }