mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 05:17:03 +05:30
refactor(common): expose fields for LobstersCard
previews
This commit is contained in:
parent
1238012e0b
commit
433727a386
1 changed files with 49 additions and 48 deletions
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package dev.msfjarvis.claw.common.posts
|
package dev.msfjarvis.claw.common.posts
|
||||||
|
|
||||||
|
import androidx.annotation.VisibleForTesting
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
@ -235,26 +236,8 @@ private fun TagText(tag: String, modifier: Modifier = Modifier) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ThemePreviews
|
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||||
@Composable
|
val TEST_POST_ACTIONS =
|
||||||
private fun LobstersCardPreview() {
|
|
||||||
LobstersTheme {
|
|
||||||
LobstersCard(
|
|
||||||
post =
|
|
||||||
UIPost(
|
|
||||||
shortId = "ooga",
|
|
||||||
title = "Simple Anomaly Detection Using Plain SQL",
|
|
||||||
url = "https://hakibenita.com/sql-anomaly-detection",
|
|
||||||
createdAt = "2020-09-21T08:04:24.000-05:00",
|
|
||||||
commentCount = 1,
|
|
||||||
commentsUrl = "https://lobste.rs/s/q1hh1g/simple_anomaly_detection_using_plain_sql",
|
|
||||||
submitter = "Haki",
|
|
||||||
tags = listOf("databases", "apis"),
|
|
||||||
description = "",
|
|
||||||
isSaved = true,
|
|
||||||
isRead = true,
|
|
||||||
),
|
|
||||||
postActions =
|
|
||||||
object : PostActions {
|
object : PostActions {
|
||||||
override fun viewPost(postId: String, postUrl: String, commentsUrl: String) {}
|
override fun viewPost(postId: String, postUrl: String, commentsUrl: String) {}
|
||||||
|
|
||||||
|
@ -282,8 +265,26 @@ private fun LobstersCardPreview() {
|
||||||
override suspend fun getLinkMetadata(url: String): LinkMetadata {
|
override suspend fun getLinkMetadata(url: String): LinkMetadata {
|
||||||
return LinkMetadata("", "")
|
return LinkMetadata("", "")
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
refresh = {},
|
|
||||||
|
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||||
|
val TEST_POST =
|
||||||
|
UIPost(
|
||||||
|
shortId = "ooga",
|
||||||
|
title = "Simple Anomaly Detection Using Plain SQL",
|
||||||
|
url = "https://hakibenita.com/sql-anomaly-detection",
|
||||||
|
createdAt = "2020-09-21T08:04:24.000-05:00",
|
||||||
|
commentCount = 1,
|
||||||
|
commentsUrl = "https://lobste.rs/s/q1hh1g/simple_anomaly_detection_using_plain_sql",
|
||||||
|
submitter = "Haki",
|
||||||
|
tags = listOf("databases", "apis"),
|
||||||
|
description = "",
|
||||||
|
isSaved = true,
|
||||||
|
isRead = true,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
@ThemePreviews
|
||||||
|
@Composable
|
||||||
|
private fun LobstersCardPreview() {
|
||||||
|
LobstersTheme { LobstersCard(post = TEST_POST, postActions = TEST_POST_ACTIONS, refresh = {}) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue