Skip to content

Fix previews for JetLaggedScreen and HeartRateCard #1548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import com.example.jetlagged.ui.theme.JetLaggedTheme
import com.example.jetlagged.ui.util.MultiDevicePreview

@OptIn(ExperimentalLayoutApi::class)
@MultiDevicePreview
@Composable
fun JetLaggedScreen(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -126,3 +125,11 @@ fun JetLaggedScreen(
}
}
}

@MultiDevicePreview
@Composable
private fun JetLaggedScreenPreview() {
JetLaggedTheme {
JetLaggedScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import com.example.jetlagged.ui.theme.JetLaggedTheme
import com.example.jetlagged.ui.theme.SmallHeadingStyle
import com.example.jetlagged.ui.theme.TitleStyle

@Preview
@Composable
fun HeartRateCard(
Comment on lines 41 to 42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Moving the @Preview annotation here and creating a separate preview function is a good way to ensure the composable is rendered with the JetLaggedTheme in the IDE.

modifier: Modifier = Modifier,
Expand Down Expand Up @@ -77,3 +76,11 @@ fun HeartRateCard(
}
}
}

@Preview
@Composable
private fun HeartRateCardPreview() {
JetLaggedTheme {
HeartRateCard()
}
}