-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(style-partners): migrate JobItem to tokenized based component.
- Loading branch information
1 parent
4b203bb
commit 37b1dc4
Showing
12 changed files
with
175 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
...ners-ui/src/main/kotlin/org/gdglille/devfest/android/theme/m3/partners/ui/jobs/JobItem.kt
This file was deleted.
Oops, something went wrong.
5 changes: 1 addition & 4 deletions
5
...kotlin/org/gdglille/devfest/android/theme/m3/partners/ui/partners/PartnerDetailSection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...id/theme/m3/style/partners/PartnerItem.kt → ...me/m3/style/partners/items/PartnerItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../m3/style/partners/PartnerItemDefaults.kt → ...yle/partners/items/PartnerItemDefaults.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...me/m3/style/partners/PartnerItemTokens.kt → ...style/partners/items/PartnerItemTokens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
...ners/src/main/kotlin/org/gdglille/devfest/android/theme/m3/style/partners/jobs/JobItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.partners.jobs | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Payments | ||
import androidx.compose.material.icons.outlined.Work | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.res.pluralStringResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme | ||
import org.gdglille.devfest.android.theme.m3.style.R | ||
import org.gdglille.devfest.android.theme.m3.style.previews.ThemedPreviews | ||
import org.gdglille.devfest.android.theme.m3.style.tags.MediumTag | ||
import org.gdglille.devfest.android.theme.m3.style.tags.TagDefaults | ||
import org.gdglille.devfest.android.theme.m3.style.toDp | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun JobItem( | ||
title: String, | ||
description: String, | ||
requirements: Int, | ||
propulsedBy: String, | ||
salaryMin: Int?, | ||
salaryMax: Int?, | ||
salaryRecurrence: String?, | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
containerColor: Color = JobItemDefaults.containerColor, | ||
shape: Shape = JobItemDefaults.shape, | ||
titleTextStyle: TextStyle = JobItemDefaults.titleTextStyle, | ||
descriptionTextStyle: TextStyle = JobItemDefaults.descriptionTextStyle | ||
) { | ||
Card( | ||
shape = shape, | ||
colors = CardDefaults.cardColors(containerColor = containerColor), | ||
modifier = modifier, | ||
onClick = onClick | ||
) { | ||
Column(modifier = Modifier.padding(JobItemTokens.ContainerPadding.toDp())) { | ||
Text( | ||
text = title, | ||
style = titleTextStyle, | ||
modifier = Modifier.padding(start = JobItemTokens.ContentStartPadding.toDp()) | ||
) | ||
Text( | ||
text = description, | ||
style = descriptionTextStyle, | ||
modifier = Modifier.padding(start = JobItemTokens.ContentStartPadding.toDp()) | ||
) | ||
Row( | ||
modifier = Modifier.padding(top = JobItemTokens.TagTopPadding.toDp()) | ||
) { | ||
if (salaryMin != null && salaryMax != null && salaryRecurrence != null) { | ||
MediumTag( | ||
text = stringResource( | ||
id = R.string.text_job_salary, | ||
salaryMin, | ||
salaryMax, | ||
salaryRecurrence | ||
), | ||
icon = Icons.Outlined.Payments, | ||
colors = TagDefaults.unStyledColors() | ||
) | ||
} | ||
MediumTag( | ||
text = pluralStringResource( | ||
id = R.plurals.text_job_requirements, | ||
count = requirements, | ||
requirements | ||
), | ||
icon = Icons.Outlined.Work, | ||
colors = TagDefaults.unStyledColors() | ||
) | ||
} | ||
MediumTag( | ||
text = stringResource(id = R.string.text_job_propulsed, propulsedBy), | ||
colors = TagDefaults.gravelColors(), | ||
modifier = Modifier.padding( | ||
top = JobItemTokens.TagTopPadding.toDp(), | ||
start = JobItemTokens.ContentStartPadding.toDp() | ||
) | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Suppress("UnusedPrivateMember") | ||
@ThemedPreviews | ||
@Composable | ||
private fun JobItemPreview() { | ||
Conferences4HallTheme { | ||
JobItem( | ||
title = "Mobile Staff Engineer", | ||
description = "Google - Paris, France", | ||
requirements = 5, | ||
propulsedBy = "WeLoveDevs", | ||
salaryMin = 55, | ||
salaryMax = 75, | ||
salaryRecurrence = "year", | ||
onClick = {}, | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../main/kotlin/org/gdglille/devfest/android/theme/m3/style/partners/jobs/JobItemDefaults.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.partners.jobs | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.text.TextStyle | ||
import org.gdglille.devfest.android.theme.m3.style.toColor | ||
import org.gdglille.devfest.android.theme.m3.style.toShape | ||
import org.gdglille.devfest.android.theme.m3.style.toTextStyle | ||
|
||
object JobItemDefaults { | ||
val containerColor: Color | ||
@Composable | ||
get() = JobItemTokens.ContainerColor.toColor() | ||
val shape: Shape | ||
@Composable | ||
get() = JobItemTokens.ContainerShape.toShape() | ||
val titleTextStyle: TextStyle | ||
@Composable | ||
get() = JobItemTokens.TitleTextStyle.toTextStyle() | ||
val descriptionTextStyle: TextStyle | ||
@Composable | ||
get() = JobItemTokens.DescriptionTextStyle.toTextStyle() | ||
} |
16 changes: 16 additions & 0 deletions
16
...rc/main/kotlin/org/gdglille/devfest/android/theme/m3/style/partners/jobs/JobItemTokens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.partners.jobs | ||
|
||
import org.gdglille.devfest.android.theme.m3.style.ColorSchemeTokens | ||
import org.gdglille.devfest.android.theme.m3.style.ShapeTokens | ||
import org.gdglille.devfest.android.theme.m3.style.SpacingTokens | ||
import org.gdglille.devfest.android.theme.m3.style.TextStyleTokens | ||
|
||
object JobItemTokens { | ||
val ContainerColor = ColorSchemeTokens.SurfaceVariantColor | ||
val ContainerShape = ShapeTokens.MediumShape | ||
val ContainerPadding = SpacingTokens.MediumSpacing | ||
val TitleTextStyle = TextStyleTokens.TitleMedium | ||
val DescriptionTextStyle = TextStyleTokens.BodyMedium | ||
val ContentStartPadding = SpacingTokens.MediumSpacing | ||
val TagTopPadding = SpacingTokens.SmallSpacing | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters