Skip to content

Commit

Permalink
feat: footer_sidebar auto width
Browse files Browse the repository at this point in the history
  • Loading branch information
papierkorp committed Sep 27, 2023
1 parent 9fbec3d commit 94065b5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ layouts:
### Footer Sidebar

The footer Sidebar is the content directly above the footer.
Per default there are 4 elements available:
Per default there are 6 elements available:

**description:** Uses the `description:` of `_config` to display all the data from there. For the best experience you should use an <h1></h1> on the top.
**categories:** Shows random categories according to the count.
Expand All @@ -404,6 +404,7 @@ description: >- # this means to ignore newlines until
</p>
footer_sidebar:
auto: false # false = all elements will have the same width, true = each element takes what it needs
arrangement: # you can rearrange the positions of the elements
- description # will be the first one to be displayed
- tags # second in the row ...
Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ navigation:
url: /search.html

footer_sidebar:
auto: true
arrangement:
- description
- tags
Expand Down
2 changes: 1 addition & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


{% if site.footer_sidebar.arrangement %}
<aside class="footer_sidebar">
<aside class="footer_sidebar footer_aside{% if site.footer_sidebar.auto %}_auto{% endif %}">
{% for section in site.footer_sidebar.arrangement %}
{% if section == 'description' and site.footer_sidebar.description.enabled %}
<section class="footer_sitedescription footer_sitedescription{% if site.footer_sidebar.description.columns and site.footer_sidebar.description.columns >= 0 and site.footer_sidebar.description.columns <= 5 %}{{site.footer_sidebar.description.columns}}{% else %}0{% endif %}">
Expand Down
33 changes: 23 additions & 10 deletions _sass/default/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,47 +57,60 @@ footer aside {
max-height: max-content;
}

footer .footer_aside_auto section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: fit-content;
}

/* one item */
footer aside section:first-child:nth-last-child(1) {
footer .footer_aside section:first-child:nth-last-child(1) {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 100%;
}

/* two items */
footer aside section:first-child:nth-last-child(2),
footer aside section:first-child:nth-last-child(2) ~ section {
footer .footer_aside section:first-child:nth-last-child(2),
footer .footer_aside section:first-child:nth-last-child(2) ~ section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 50%;
}

/* three items */
footer aside section:first-child:nth-last-child(3),
footer aside section:first-child:nth-last-child(3) ~ section {
footer .footer_aside section:first-child:nth-last-child(3),
footer .footer_aside section:first-child:nth-last-child(3) ~ section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 33%;
}

/* four items */
footer aside section:first-child:nth-last-child(4),
footer aside section:first-child:nth-last-child(4) ~ section {
footer .footer_aside section:first-child:nth-last-child(4),
footer .footer_aside section:first-child:nth-last-child(4) ~ section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 25%;
}

/* five items */
footer aside section:first-child:nth-last-child(5),
footer aside section:first-child:nth-last-child(5) ~ section {
footer .footer_aside section:first-child:nth-last-child(5),
footer .footer_aside section:first-child:nth-last-child(5) ~ section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 20%;
}

footer aside section:first-child {
/* six items */
footer .footer_aside section:first-child:nth-last-child(6),
footer .footer_aside section:first-child:nth-last-child(6) ~ section {
padding: 0 0 0 1em;
flex-grow: 1;
max-width: 16%;
}

footer .footer_aside section:first-child {
padding: 0;
}

Expand Down
6 changes: 6 additions & 0 deletions _sass/layouts/_home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
color: $primary-color;
}

span {
&:hover {
@include hover();
}
}


.page_count {
margin: 0 auto;
Expand Down

0 comments on commit 94065b5

Please sign in to comment.