Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/BuildConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

object BuildConstants {

const val VersionName = "3.0.0-alpha11"
const val VersionName = "3.0.0-alpha12"

const val Namespace = "com.moveagency.markymark"

const val MinSdk = 24
const val TargetSdk = 34
const val TargetSdk = 35
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,23 @@ fun MarkyMarkQuote(
}
.padding(style.innerPadding)
) {
if (theme?.colors != null) {
CompositionLocalProvider(LocalMarkyMarkColors provides theme.colors) {
val parent = LocalMarkyMarkTheme.current.styles.composable
val inner = style.contentStyle?.invoke(parent) ?: parent

CompositionLocalProvider(
LocalMarkyMarkTheme provides LocalMarkyMarkTheme.current.copy(
styles = LocalMarkyMarkTheme.current.styles.copy(
composable = inner
)
)
) {
if (theme?.colors != null) {
CompositionLocalProvider(LocalMarkyMarkColors provides theme.colors) {
children()
}
} else {
children()
}
} else {
children()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.moveagency.markymark.composable.MarkyMarkQuote
import com.moveagency.markymark.model.composable.BlockQuote
import com.moveagency.markymark.theme.ComposableStyles
import com.moveagency.markymark.theme.MarkyMarkThemeBuilderMarker
import com.moveagency.markymark.theme.Padding
import kotlinx.collections.immutable.ImmutableList
Expand All @@ -40,9 +41,9 @@ import kotlinx.collections.immutable.toImmutableList
* @property innerPadding The padding inside the block quote.
* @property outerPadding The padding outside the block quote, around the entire block.
* @property indicatorThickness The thickness of the block quote indicator, defined in [Dp].
* @property indicatorTint The color tint applied to the block quote indicator.
* @property themes A list of themes used for rendering the block quote's content.
* @property shape The shape of the block quote, such as a rectangle or other custom shape.
* @property contentStyle The text style applied to the content inside the code block.
Comment thread
prorobbert marked this conversation as resolved.
Outdated
*/
@Immutable
data class BlockQuoteStyle private constructor(
Expand All @@ -51,6 +52,7 @@ data class BlockQuoteStyle private constructor(
val indicatorThickness: Dp,
val themes: ImmutableList<BlockQuoteTheme>,
val shape: Shape,
val contentStyle: ((parent: ComposableStyles) -> ComposableStyles)? = null,
) {

/**
Expand Down Expand Up @@ -84,6 +86,11 @@ data class BlockQuoteStyle private constructor(
*/
var shape: Shape = RectangleShape

/**
* The text style applied to the content inside the code block. Default is an empty [ComposableStyles].
*/
Comment thread
prorobbert marked this conversation as resolved.
var contentStyle: ((ComposableStyles) -> ComposableStyles)? = null

/**
* Includes another [Builder] instance's configuration into `this` builder.
*
Expand All @@ -97,6 +104,7 @@ data class BlockQuoteStyle private constructor(
indicatorThickness = builder.indicatorThickness
themes.include(builder.themes)
shape = builder.shape
contentStyle = builder.contentStyle
}

/**
Expand All @@ -112,6 +120,7 @@ data class BlockQuoteStyle private constructor(
indicatorThickness = style.indicatorThickness
themes.include(style.themes)
shape = style.shape
contentStyle = style.contentStyle
}

/**
Expand All @@ -135,17 +144,32 @@ data class BlockQuoteStyle private constructor(
*/
fun themes(block: BlockQuoteThemesBuilder.() -> Unit) = block(themes)

/**
* Configures the content style for the block quote.
*
* @param overrides A lambda to override the [ComposableStyles.Builder] for the content.
*/
fun contentStyle(overrides: ComposableStyles.Builder.() -> Unit) {
contentStyle = { parent ->
ComposableStyles.Builder().apply {
include(parent)
overrides()
}.build()
}
}

/**
* Builds a new [BlockQuoteStyle] instance with the current configuration.
*
* @return A [BlockQuoteStyle] object with the set properties for the block quote.
*/
internal fun build() = BlockQuoteStyle(
internal fun build(): BlockQuoteStyle = BlockQuoteStyle(
innerPadding = innerPadding.build(),
outerPadding = outerPadding.build(),
indicatorThickness = indicatorThickness,
themes = themes.build(),
shape = shape,
contentStyle = contentStyle
)
}

Expand Down
Loading