Restyle lists
This commit is contained in:
parent
3714a0c5cf
commit
a4581e255f
83
assets/sass/_list.scss
Normal file
83
assets/sass/_list.scss
Normal file
@ -0,0 +1,83 @@
|
||||
$list-item-image-size: 32px;
|
||||
|
||||
.list {
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
h3 {}
|
||||
|
||||
.view-all {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
|
||||
&:after {
|
||||
content: "»";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-items-container {
|
||||
ul.list-items {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
||||
li.list-item {
|
||||
display: flex;
|
||||
|
||||
background-color: rgba(white, 0.05);
|
||||
transition: transform 150ms ease-in;
|
||||
|
||||
border-radius: 16px;
|
||||
padding: 8px;
|
||||
|
||||
user-select: none;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
&[data-href] {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
transform: translateX(2rem);
|
||||
|
||||
@media (max-width: $xl) {
|
||||
transform: translateX(1rem);
|
||||
}
|
||||
|
||||
@media (max-width: $lg) {
|
||||
transform: translateX(0.5rem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item-image {
|
||||
max-width: $list-item-image-size;
|
||||
max-height: $list-item-image-size;
|
||||
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.list-item-text {
|
||||
h4.list-item-title {
|
||||
line-height: $list-item-image-size;
|
||||
font-size: 1.2rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
span.list-item-date {
|
||||
display: block
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,8 +9,9 @@
|
||||
|
||||
// Generic styling
|
||||
@import "container";
|
||||
|
||||
// Component specific styling
|
||||
@import "layout";
|
||||
@import "header";
|
||||
@import "footer";
|
||||
|
||||
// Component-specific styling
|
||||
@import "list"
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
{{ define "main" }}
|
||||
<section class="blog-recent">
|
||||
{{ partial "snippet-list" (dict "showAllArticles" true) }}
|
||||
</section>
|
||||
{{ partial "snippet-list" (dict "showAllArticles" true) }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "aside" }}
|
||||
|
||||
@ -1,22 +1,24 @@
|
||||
<div class="header">
|
||||
<h3>Latest Articles</h3>
|
||||
<section class="list">
|
||||
<div class="header">
|
||||
<h3>Latest Articles</h3>
|
||||
|
||||
{{ if index $ "showAllArticles" }}
|
||||
<div class="all-articles">
|
||||
<a href="javascript:void(0)">All articles</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="list">
|
||||
<ul class="blog-items">
|
||||
{{ range ( first 3 (where site.RegularPages "Type" "snippets").ByDate.Reverse ) }}
|
||||
<li class="blog-item" data-href="{{ .Permalink }}">
|
||||
<img class="article-image" src="//via.placeholder.com/128" alt="Article Topic">
|
||||
<div class="article-text">
|
||||
<h4 class="article-title">{{ .Title }}</h4>
|
||||
<span class="article-date">{{ .Date.Format "January 2, 2006" }}</span>
|
||||
</div>
|
||||
</li>
|
||||
{{ if index $ "showAllArticles" }}
|
||||
<div class="view-all">
|
||||
<a href="javascript:void(0)">All articles</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-items-container">
|
||||
<ul class="list-items">
|
||||
{{ range ( first 3 (where site.RegularPages "Type" "snippets").ByDate.Reverse ) }}
|
||||
<li class="list-item" data-href="{{ .Permalink }}">
|
||||
<img class="list-item-image" src="//via.placeholder.com/128" alt="Article Topic">
|
||||
<div class="list-item-text">
|
||||
<h4 class="list-item-title">{{ .Title }}</h4>
|
||||
<span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span>
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
{{ define "main" }}
|
||||
<section class="blog-recent">
|
||||
{{ partial "snippet-list" (dict) }}
|
||||
</section>
|
||||
{{ partial "snippet-list" (dict) }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "aside" }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user