feat: added title-line-limit for horizontal-cards style
This commit is contained in:
parent
d60457afaf
commit
b4d49ecf34
3 changed files with 17 additions and 10 deletions
|
@ -465,15 +465,16 @@ Example:
|
|||
```
|
||||
|
||||
#### Properties
|
||||
| Name | Type | Required | Default |
|
||||
| ---- | ---- | -------- | ------- |
|
||||
| style | string | no | vertical-list |
|
||||
| feeds | array | yes |
|
||||
| thumbnail-height | float | no | 10 |
|
||||
| card-height | float | no | 27 |
|
||||
| limit | integer | no | 25 |
|
||||
| single-line-titles | boolean | no | false |
|
||||
| collapse-after | integer | no | 5 |
|
||||
| Name | Type | Required | Default | Note
|
||||
| ---- | ---- | -------- | ------- | ------- |
|
||||
| style | string | no | vertical-list | |
|
||||
| feeds | array | yes | |
|
||||
| thumbnail-height | float | no | 10 | |
|
||||
| card-height | float | no | 27 | |
|
||||
| limit | integer | no | 25 | |
|
||||
| single-line-titles | boolean | no | false | |
|
||||
| collapse-after | integer | no | 5 | |
|
||||
| title-line-limit | integer | no | 3 | Only applicable for `horizontal-cards` style. Max is 3 |
|
||||
|
||||
##### `style`
|
||||
Used to change the appearance of the widget. Possible values are:
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
</svg>
|
||||
{{ end }}
|
||||
<div class="margin-bottom-widget padding-inline-widget flex flex-column grow">
|
||||
<a href="{{ .Link }}" title="{{ .Title }}" class="text-truncate-3-lines color-primary-if-not-visited margin-top-10 margin-bottom-auto" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
||||
<a href="{{ .Link }}" title="{{ .Title }}"
|
||||
class="{{ if eq $.TitleLineLimit 1 }}text-truncate{{ else }}text-truncate-{{ $.TitleLineLimit }}-lines{{ end }} color-primary-if-not-visited margin-top-10 margin-bottom-auto" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
||||
<ul class="list-horizontal-text flex-nowrap margin-top-7">
|
||||
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
||||
<li class="min-width-0 text-truncate">{{ .ChannelName }}</li>
|
||||
|
|
|
@ -15,6 +15,7 @@ type RSS struct {
|
|||
Style string `yaml:"style"`
|
||||
ThumbnailHeight float64 `yaml:"thumbnail-height"`
|
||||
CardHeight float64 `yaml:"card-height"`
|
||||
TitleLineLimit int `yaml:"title-line-limit"`
|
||||
Items feed.RSSFeedItems `yaml:"-"`
|
||||
Limit int `yaml:"limit"`
|
||||
CollapseAfter int `yaml:"collapse-after"`
|
||||
|
@ -41,6 +42,10 @@ func (widget *RSS) Initialize() error {
|
|||
widget.CardHeight = 0
|
||||
}
|
||||
|
||||
if widget.TitleLineLimit <= 0 || widget.TitleLineLimit > 3 {
|
||||
widget.TitleLineLimit = 3
|
||||
}
|
||||
|
||||
if widget.Style == "detailed-list" {
|
||||
for i := range widget.FeedRequests {
|
||||
widget.FeedRequests[i].IsDetailed = true
|
||||
|
|
Loading…
Add table
Reference in a new issue