Skip to content

Commit

Permalink
Create animiteBlockQuoteStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
imashnake0 committed Feb 24, 2024
1 parent 3cdf191 commit 5cef1ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
Expand Down

0 comments on commit 5cef1ed

Please sign in to comment.