Browse Source

network cards now have a different layout for portrait and landscape mode

main
rra 3 years ago
parent
commit
7e59454c19
  1. 39
      layouts/partials/network_card.html
  2. 41
      static/css/main.css

39
layouts/partials/network_card.html

@ -1,33 +1,36 @@
<div class='network card'> <div class='network card'>
<article class="h-entry network"> <article class="h-entry network">
<header> <header>
{{ $postPermalink := .Permalink}}
<h2 class="p-name"><a href="{{ .Permalink }}" class="u-url">{{ .Title }}</a></h2> <h2 class="p-name"><a href="{{ .Permalink }}" class="u-url">{{ .Title }}</a></h2>
<div class="header-metadata">
<time class="dt-published" datetime="{{ .Date.Format `Jan 02 2006` }}">{{ .Date.Format "Jan 02, 2006" }}</time>
<div class="filler"></div>
</div>
</header> </header>
<div class="network-source"><span class="from p-author">From {{ if .Params.author }}<b>{{.Params.author}}</b> at {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ .Params.feed_name | urlize }}">{{ .Params.feed_name }}</a></span></div> <div class="network-source"><span class="from p-author">From {{ if .Params.author }}<b>{{.Params.author}}</b> at {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ .Params.feed_name | urlize }}">{{ .Params.feed_name }}</a></span></div>
{{ with (index (.Resources.ByType "image") 0) }}
<div class="p-summary {{if .Truncated}} truncated {{end}} img" > {{ $height := add .Height 0.0}}
{{ with (index (.Resources.ByType "image") 0) }} {{ $ratio := div $height .Width}}
{{ $thumb := .Fit "540x360"}} {{ $thumb := .Fit "540x360"}}
<div class="summary-image"> <div class="p-summary{{if gt $ratio 1 }} portrait {{else}} landscape {{end}}">
<img src="{{ $thumb.Permalink }}" alt="{{ .Title }}"> <div class="summary-image {{if gt $ratio 1 }} portrait {{else}} landscape {{end}}">
</div> <a href="{{ $postPermalink }}"><img src="{{ $thumb.Permalink }}" alt="{{ .Title }}"> </a>
</div>
{{ else }}
<div class="p-summary">
{{ end }} {{ end }}
<div class="summary-text"> <div class="summary-text">
{{ .Summary }} {{ .Summary }}
</div> </div>
</div>
</div> <footer class='post-footer'>
{{ if .Truncated }} <div class='footer-filler'>
<footer class='post-footer'> <time class="dt-published" datetime="{{ .Date.Format `Jan 02 2006` }}">{{ .Date.Format "Jan 02, 2006" }}</time>
</div>
{{ if .Truncated }}
<div class='read-more'><a href="{{ .RelPermalink }}">Read More…</a></div> <div class='read-more'><a href="{{ .RelPermalink }}">Read More…</a></div>
<div class='footer-filler'></div> {{ end }}
</footer> </footer>
{{ end }}
</article> </article>
</div> </div>

41
static/css/main.css

@ -206,19 +206,22 @@ body {
.summary-text { .summary-text {
flex: 1; flex: 1;
padding: 1em; padding: 1em;
max-height: 300px; min-width: 34ch;
min-width: 20ch;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.summary-image > img { .summary-image > img {
height: 100%; /* height: 100%;
object-fit: cover; object-fit: cover;
max-width: 100%; max-width: 100%;*/
} }
.summary-image > a {
display: flex;
}
.summary-image{ .summary-image{
border-right: 2px solid var(--border-color); border-right: 2px solid var(--border-color);
} }
@ -247,7 +250,7 @@ footer.post-footer {
border: 2px solid darkcyan; border: 2px solid darkcyan;
box-shadow:1em 1em 0 #d2d1c8; box-shadow:1em 1em 0 #d2d1c8;
background-color: lightgreen; background-color: lightgreen;
max-width: 540px; max-width: min-content;
margin-bottom: 2em; margin-bottom: 2em;
flex: auto; flex: auto;
margin: 0 3em 3em 0; margin: 0 3em 3em 0;
@ -264,7 +267,7 @@ footer.post-footer {
.h-entry.network header h2{ .h-entry.network header h2{
padding: 0.2em 0.5em 0.2em 0.5em; padding: 0.2em 0.5em 0.2em 0.5em;
margin: 0; margin: 0;
border-color: darkcyan; border: none;
} }
.h-entry.network header h2:hover{ .h-entry.network header h2:hover{
@ -282,8 +285,7 @@ footer.post-footer {
} }
.network .header-metadata .dt-published{ .network .header-metadata .dt-published{
padding-left: 1.2em;
min-width: 16ch;
border-bottom: 2px solid darkcyan; border-bottom: 2px solid darkcyan;
} }
@ -296,15 +298,25 @@ footer.post-footer {
padding: 0.5em 1.2em 0.5em 1.2em; padding: 0.5em 1.2em 0.5em 1.2em;
} }
.network footer.post-footer{ .network .p-summary {
border-top: 2px solid darkcyan; display: flex;
} }
.network .summary-image { .network .p-summary.portrait {
flex-direction: row;
}
.network .p-summary.landscape{
flex-direction: column;
}
.network .summary-image.portrait {
border-right: 2px solid darkcyan;
}
.network .summary-image.landscape {
border-bottom: 2px solid darkcyan; border-bottom: 2px solid darkcyan;
border-right: none; border-right: none;
} }
.network .summary-image > img { .network .summary-image > img {
display: inherit; display: inherit;
} }
@ -333,6 +345,13 @@ div.network-source{
border-left: 2px solid darkcyan; border-left: 2px solid darkcyan;
} }
.network footer.post-footer{
border-top: 2px solid darkcyan;
flex-flow: row;
font-size: 0.8rem;
padding-left: 1.2em;
min-width: 16ch;
}
/* calendar cards */ /* calendar cards */

Loading…
Cancel
Save