Skip to content

Commit

Permalink
refactor(style): create dedicated module for markdown and permissions.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Mar 9, 2024
1 parent fe53e4d commit f4ab7c1
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 53 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ apache-xmlgraphics-batik = "1.17"
cash-sqldelight = "2.0.1"
coil = "2.5.0"
detekt = "1.23.4"
font-awesome = "1.0.0"
font-awesome = "1.1.0"
google-accompanist = "0.32.0"
google-cloud-firestore = "3.7.3"
google-cloud-secretmanager = "2.3.10"
Expand Down Expand Up @@ -79,7 +79,7 @@ compose-linter = { group = "com.slack.lint.compose", name = "compose-lint-checks

detekt-gradlePlugin = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gradle-plugin", version.ref = "detekt" }

font-awesome = { group = "br.com.devsrsouza.compose.icons.android", name = "font-awesome", version.ref = "font-awesome" }
font-awesome = { group = "br.com.devsrsouza.compose.icons", name = "font-awesome", version.ref = "font-awesome" }

jetbrains-compose-gradlePlugin = { group = "org.jetbrains.compose", name = "compose-gradle-plugin", version.ref = "jetbrains-compose" }
jetbrains-kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "jetbrains-kotlin" }
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ include(":theme-m3:event-list:event-list-feature")
include(":theme-m3:event-list:event-list-di")
include(":theme-m3:navigation")
include(":theme-m3:style:networking")
include(":theme-m3:style:markdown")
include(":theme-m3:style:partners")
include(":theme-m3:style:permissions")
include(":theme-m3:style:schedules")
include(":theme-m3:style:speakers")
include(":theme-m3:style:theme")
Expand Down
1 change: 1 addition & 0 deletions theme-m3/infos/infos-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation(projects.shared.core)
implementation(projects.themeM3.infos.infosUi)
implementation(projects.themeM3.navigation)
implementation(projects.themeM3.style.permissions)
implementation(projects.themeM3.style.theme)

implementation(libs.koin.androidx.compose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ fun Event(
title = event.eventInfo.name,
pronouns = null,
subtitle = event.eventInfo.date,
onLinkClicked = onLinkClicked,
modifier = Modifier.padding(horizontal = 16.dp),
isLoading = isLoading,
twitterUrl = event.eventInfo.twitterUrl,
linkedinUrl = event.eventInfo.linkedinUrl,
onLinkClicked = onLinkClicked,
modifier = Modifier.padding(horizontal = 16.dp)
linkedinUrl = event.eventInfo.linkedinUrl
)
}
event.ticket?.let {
Expand Down
1 change: 1 addition & 0 deletions theme-m3/networking/networking-feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies {
implementation(projects.themeM3.networking.networkingUi)
implementation(projects.themeM3.navigation)
implementation(projects.themeM3.style.networking)
implementation(projects.themeM3.style.permissions)
implementation(projects.themeM3.style.theme)

implementation(libs.koin.androidx.compose)
Expand Down
1 change: 1 addition & 0 deletions theme-m3/partners/partners-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android {
dependencies {
implementation(projects.shared.uiModels)
implementation(projects.themeM3.navigation)
implementation(projects.themeM3.style.markdown)
implementation(projects.themeM3.style.partners)
implementation(projects.themeM3.style.theme)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.android.theme.m3.style.markdowns.MarkdownText
import org.gdglille.devfest.android.theme.m3.style.markdown.MarkdownText
import org.gdglille.devfest.android.theme.m3.style.partners.items.PartnerItem
import org.gdglille.devfest.android.theme.m3.style.placeholder
import org.gdglille.devfest.android.theme.m3.style.previews.ThemedPreviews
Expand Down Expand Up @@ -44,12 +44,12 @@ fun PartnerDetailSectionVertical(
title = partnerItemUi.name,
pronouns = null,
subtitle = null,
onLinkClicked = onLinkClicked,
isLoading = isLoading,
twitterUrl = partnerItemUi.twitterUrl,
githubUrl = null,
linkedinUrl = partnerItemUi.linkedinUrl,
websiteUrl = partnerItemUi.siteUrl,
onLinkClicked = onLinkClicked
websiteUrl = partnerItemUi.siteUrl
)
Spacer(modifier = Modifier.height(8.dp))
MarkdownText(
Expand Down
1 change: 1 addition & 0 deletions theme-m3/speakers/speakers-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {

dependencies {
implementation(projects.shared.uiModels)
implementation(projects.themeM3.style.markdown)
implementation(projects.themeM3.style.speakers)
implementation(projects.themeM3.style.theme)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.android.theme.m3.style.markdowns.MarkdownText
import org.gdglille.devfest.android.theme.m3.style.markdown.MarkdownText
import org.gdglille.devfest.android.theme.m3.style.placeholder
import org.gdglille.devfest.android.theme.m3.style.previews.ThemedPreviews
import org.gdglille.devfest.android.theme.m3.style.socials.SocialsSection
Expand Down Expand Up @@ -42,13 +42,13 @@ fun SpeakerDetailSectionVertical(
title = speaker.name,
pronouns = speaker.pronouns,
subtitle = speaker.activity,
onLinkClicked = onLinkClicked,
isLoading = isLoading,
twitterUrl = speaker.twitterUrl,
mastodonUrl = speaker.mastodonUrl,
githubUrl = speaker.githubUrl,
linkedinUrl = speaker.linkedinUrl,
websiteUrl = speaker.websiteUrl,
onLinkClicked = onLinkClicked
websiteUrl = speaker.websiteUrl
)
Spacer(modifier = Modifier.height(8.dp))
MarkdownText(
Expand Down
1 change: 1 addition & 0 deletions theme-m3/style/markdown/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
19 changes: 19 additions & 0 deletions theme-m3/style/markdown/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("conferences4hall.android.library")
id("conferences4hall.android.library.compose")
id("conferences4hall.quality")
}

android {
namespace = "org.gdglille.devfest.android.theme.m3.style.markdown"
}

dependencies {
implementation(projects.themeM3.style.theme)

implementation(compose.material3)
implementation(compose.preview)
debugImplementation(compose.uiTooling)

implementation(libs.richtext.commonmark)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gdglille.devfest.android.theme.m3.style.markdowns
package org.gdglille.devfest.android.theme.m3.style.markdown

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -15,8 +15,8 @@ import org.gdglille.devfest.android.theme.m3.style.socials.SocialsSectionDefault
fun MarkdownText(
text: String,
modifier: Modifier = Modifier,
bodyColor: Color = SocialsSectionDefaults.bodyColor,
bodyTextStyle: TextStyle = SocialsSectionDefaults.bodyTextStyle
bodyColor: Color = MarkdownTextDefaults.bodyColor,
bodyTextStyle: TextStyle = MarkdownTextDefaults.bodyTextStyle
) {
RichTextThemeIntegration(
textStyle = { bodyTextStyle },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gdglille.devfest.android.theme.m3.style.markdowns
package org.gdglille.devfest.android.theme.m3.style.markdown

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
Expand All @@ -10,9 +10,9 @@ import org.gdglille.devfest.android.theme.m3.style.toTextStyle
object MarkdownTextDefaults {
val bodyColor: Color
@Composable
get() = SocialsSectionTokens.BodyColor.toColor()
get() = MarkdownTextTokens.BodyColor.toColor()

val bodyTextStyle: TextStyle
@Composable
get() = SocialsSectionTokens.BodyTextStyle.toTextStyle()
get() = MarkdownTextTokens.BodyTextStyle.toTextStyle()
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gdglille.devfest.android.theme.m3.style.markdowns
package org.gdglille.devfest.android.theme.m3.style.markdown

import org.gdglille.devfest.android.theme.m3.style.ColorSchemeTokens
import org.gdglille.devfest.android.theme.m3.style.TextStyleTokens
Expand Down
1 change: 1 addition & 0 deletions theme-m3/style/permissions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
19 changes: 19 additions & 0 deletions theme-m3/style/permissions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("conferences4hall.android.library")
id("conferences4hall.android.library.compose")
id("conferences4hall.quality")
}

android {
namespace = "org.gdglille.devfest.android.theme.m3.style.permissions"
}

dependencies {
implementation(projects.themeM3.style.theme)

implementation(compose.material3)
implementation(compose.preview)
debugImplementation(compose.uiTooling)

implementation(libs.google.accompanist.permissions)
}
2 changes: 0 additions & 2 deletions theme-m3/style/theme/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ dependencies {
debugImplementation(compose.uiTooling)
implementation(compose.materialIconsExtended)

implementation(libs.google.accompanist.permissions)
implementation(libs.google.accompanist.placeholder)

implementation(libs.jetbrains.kotlinx.collections)

implementation(libs.font.awesome)
implementation(libs.richtext.commonmark)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.RichText
import com.halilibo.richtext.ui.RichTextThemeIntegration
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.android.theme.m3.style.placeholder
import org.gdglille.devfest.android.theme.m3.style.toDp
Expand All @@ -28,7 +25,6 @@ fun SocialsSection(
subtitle: String?,
onLinkClicked: (url: String) -> Unit,
modifier: Modifier = Modifier,
detailed: String? = null,
isLoading: Boolean = false,
twitterUrl: String? = null,
mastodonUrl: String? = null,
Expand All @@ -38,11 +34,9 @@ fun SocialsSection(
titleColor: Color = SocialsSectionDefaults.titleColor,
pronounsColor: Color = SocialsSectionDefaults.pronounsColor,
subTitleColor: Color = SocialsSectionDefaults.subTitleColor,
bodyColor: Color = SocialsSectionDefaults.bodyColor,
titleTextStyle: TextStyle = SocialsSectionDefaults.titleTextStyle,
pronounsTextStyle: TextStyle = SocialsSectionDefaults.pronounsTextStyle,
subTitleTextStyle: TextStyle = SocialsSectionDefaults.subTitleTextStyle,
bodyTextStyle: TextStyle = SocialsSectionDefaults.bodyTextStyle
subTitleTextStyle: TextStyle = SocialsSectionDefaults.subTitleTextStyle
) {
Column(modifier = modifier.fillMaxWidth()) {
Text(
Expand Down Expand Up @@ -120,19 +114,6 @@ fun SocialsSection(
}
}
}
detailed?.let {
Spacer(modifier = Modifier.height(SocialsSectionTokens.TopBodySpacing.toDp()))
RichTextThemeIntegration(
textStyle = { bodyTextStyle },
ProvideTextStyle = null,
contentColor = { bodyColor },
ProvideContentColor = null,
) {
RichText(modifier = Modifier.placeholder(visible = isLoading)) {
Markdown(detailed)
}
}
}
}
}

Expand All @@ -144,11 +125,11 @@ internal fun SocialsSectionPreview() {
title = "Gérard Paligot",
pronouns = "Him/He",
subtitle = null,
onLinkClicked = {},
twitterUrl = "",
githubUrl = "",
linkedinUrl = "",
websiteUrl = "",
onLinkClicked = {}
websiteUrl = ""
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,4 @@ object SocialsSectionDefaults {
val subTitleTextStyle: TextStyle
@Composable
get() = SocialsSectionTokens.SubTitleTextStyle.toTextStyle()

val bodyColor: Color
@Composable
get() = SocialsSectionTokens.BodyColor.toColor()

val bodyTextStyle: TextStyle
@Composable
get() = SocialsSectionTokens.BodyTextStyle.toTextStyle()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ object SocialsSectionTokens {
val SubTitleColor = ColorSchemeTokens.OnSurfaceVariant
val PronounsTextStyle = TextStyleTokens.BodyMedium
val PronounsColor = ColorSchemeTokens.OnSurfaceColor
val BodyTextStyle = TextStyleTokens.BodyMedium
val BodyColor = ColorSchemeTokens.OnSurfaceColor
val BetweenTitleAndSubTitleSpacing = SpacingTokens.SmallSpacing
val BetweenTitleAndSocialsSpacing = SpacingTokens.MediumSpacing
val BetweenSocialIconsSpacing = SpacingTokens.LargeSpacing
val TopBodySpacing = SpacingTokens.MediumSpacing
}

0 comments on commit f4ab7c1

Please sign in to comment.