Repository: Automattic/pocket-casts-android
File: modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/UpgradeTrialTimeline.kt (Kotlin)

Code before:
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.components.TextP50
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcasts.compose.theme
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme.ThemeType
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjelly.pocketcasts.localization.R as LR

data class UpgradeTrialItem(
    val icon: Painter,
    val title: String,
    val message: String,
)

@Composable
fun previewItems() = listOf(
    UpgradeTrialItem(
        icon = painterResource(IR.drawable.ic_unlocked),
        title = stringResource(LR.string.onboarding_upgrade_schedule_today),
        message = stringResource(LR.string.onboarding_upgrade_schedule_today_message),
    ),
    UpgradeTrialItem(
        icon = painterResource(IR.drawable.ic_envelope),
        title = stringResource(LR.string.onboarding_upgrade_schedule_day, 24),
        message = stringResource(LR.string.onboarding_upgrade_schedule_notify),
    ),
    UpgradeTrialItem(
        icon = painterResource(IR.drawable.ic_star),
        title = stringResource(LR.string.onboarding_upgrade_schedule_day, 31),
        message = stringResource(LR.string.onboarding_upgrade_schedule_billing, "September 31th"),
    ),
)

@Composable
fun UpgradeTrialTimeline(
    items: List<UpgradeTrialItem>,
    modifier: Modifier = Modifier,
    spaceBetweenItems: Dp = 16.dp,
    iconSize: Dp = 43.dp,
    timelineWidth: Dp = 7.dp,
) {
    val gradientColors = listOf(
        Color.Transparent,

Review comment (suggestion):
Maybe move it to be inside the `companion object` of the `UpgradeTrialItem` type. Having top level `previewItems()` function is a bit ambiguous.

Code after:
import androidx.compose.ui.layout.Placeable
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.components.TextP50
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcasts.compose.theme
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme.ThemeType
import kotlin.math.max
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjelly.pocketcasts.localization.R as LR

data class UpgradeTrialItem(
    @DrawableRes val iconResId: Int,
    val title: String,
    val message: String,
) {
    companion object {
        @Composable
        fun getPreviewItems() = listOf(
            UpgradeTrialItem(
                iconResId = IR.drawable.ic_unlocked,
                title = stringResource(LR.string.onboarding_upgrade_schedule_today),
                message = stringResource(LR.string.onboarding_upgrade_schedule_today_message),
            ),
            UpgradeTrialItem(
                iconResId = IR.drawable.ic_envelope,
                title = stringResource(LR.string.onboarding_upgrade_schedule_day, 24),
                message = stringResource(LR.string.onboarding_upgrade_schedule_notify),
            ),
            UpgradeTrialItem(
                iconResId = IR.drawable.ic_star,
                title = stringResource(LR.string.onboarding_upgrade_schedule_day, 31),
                message = stringResource(LR.string.onboarding_upgrade_schedule_billing, "September 31th"),
            ),
        )
    }
}

@Composable
fun UpgradeTrialTimeline(
    items: List<UpgradeTrialItem>,
    modifier: Modifier = Modifier,
    spaceBetweenItems: Dp = 34.dp,