Skip to content

Commit

Permalink
Add feed icon to reader screen
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Aug 7, 2024
1 parent dd0ce16 commit a9a0af0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions shared/src/commonMain/composeResources/files/reader/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ figcaption {
font-size: 14px;
line-height: 1.6;
}
.row {
display: flex;
justify-content: center;
align-items: center;
}
.column {
margin-left: 16px;
flex: 1;
}
.caption {
font-size: 12px;
}
.feedName {
margin-bottom: 8px;
}
.feedIcon {
width: 32px;
height: auto;
}
img, figure, video, div, object {
max-width: 100%;
height: auto !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object ReaderHTML {
title: String,
feedName: String,
feedHomePageLink: String,
feedIcon: String,
publishedAt: String,
locale: String,
direction: LayoutDirection
Expand All @@ -37,6 +38,7 @@ object ReaderHTML {
postMetadata(
feedName = feedName,
feedHomePageLink = feedHomePageLink,
feedIcon = feedIcon,
publishedAt = publishedAt,
hasTitle = title.isNotBlank()
)
Expand Down Expand Up @@ -69,6 +71,7 @@ object ReaderHTML {
private fun postMetadata(
feedName: String,
feedHomePageLink: String,
feedIcon: String,
publishedAt: String,
hasTitle: Boolean,
): String {
Expand All @@ -77,10 +80,16 @@ object ReaderHTML {
appendLine("<hr class=\"top-divider\">")
}

// language=HTML
appendLine(
"""
<div class ="feedName"><a href='$feedHomePageLink'>$feedName</a></div>
<div class="caption">$publishedAt</div>
<div class="row">
<img class="feedIcon" src="$feedIcon" alt="Feed Icon">
<div class="column">
<div class ="feedName"><a href='$feedHomePageLink'>$feedName</a></div>
<div class="caption">$publishedAt</div>
</div>
</div>
<hr class="top-divider">
"""
.trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ internal fun ReaderScreen(
title = state.title!!,
feedName = state.feed!!.name,
feedHomePageLink = state.feed!!.homepageLink,
feedIcon = state.feed!!.icon,
publishedAt = state.publishedAt!!,
locale = Locale.current.toLanguageTag(),
direction = layoutDirection
Expand Down

0 comments on commit a9a0af0

Please sign in to comment.