Skip to content

Commit

Permalink
Added animiteBlockQuoteStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
imashnake0 committed Feb 19, 2024
1 parent 67b0c00 commit 2092b65
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ fun MarkdownTextPreview() {
> block quote
>> nested block quote
> nested
>> block quote
table | with | content
--- | --- | ---
Expand Down
2 changes: 2 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ kotlin {
}

dependencies {
implementation(projects.composeMarkdown)

// AndroidX
implementation(libs.androidx.activityCompose)
implementation(libs.androidx.coreKtx)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.nasdroid.core.markdown.style.BlockQuoteStyle

/**
* Constructs a better [BlockQuoteStyle].
*/
@Composable
fun animiteBlockQuoteStyle(
background: Color = MaterialTheme.colorScheme.surfaceVariant,
barWidth: Dp = 2.5f.dp,
barColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
barShape: Shape = CircleShape,
paddingAfterBar: Dp = 5f.dp,
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()
),
barShape = barShape,
barWidth = barWidth,
barColor = barColor,
paddingAfterBar = paddingAfterBar,
innerPadding = innerPadding
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import coil.compose.AsyncImage
import com.imashnake.animite.core.extensions.animiteBlockQuoteStyle
import com.imashnake.animite.core.ui.LocalPaddings
import com.imashnake.animite.core.ui.NestedScrollableContent
import com.imashnake.animite.core.ui.layouts.BannerLayout
Expand Down Expand Up @@ -99,7 +100,7 @@ fun ProfileScreen(
textStyle = m3TextStyles().textStyle.copy(color = textColor)
),
textStyleModifiers = m3TextStyleModifiers(),
blockQuoteStyle = m3BlockQuoteStyle(),
blockQuoteStyle = animiteBlockQuoteStyle(),
codeBlockStyle = m3CodeBlockStyle(),
modifier = contentModifier.clickable { }
)
Expand Down

0 comments on commit 2092b65

Please sign in to comment.