Work on the sparkline [SKIP CI]

This commit is contained in:
daudix
2024-10-18 03:23:07 +03:00
parent 8bf69a5d71
commit 932c7d9aa4
3 changed files with 40 additions and 1 deletions

22
sass/_sparkline.scss Normal file
View File

@ -0,0 +1,22 @@
.sparkline {
display: flex;
flex-direction: row;
align-items: flex-end;
float: inline-end;
gap: 0.25rem;
margin: 1rem 0;
width: 6rem;
height: 2rem;
div {
flex: 1;
transform-origin: bottom;
transition: var(--transition);
background-image: linear-gradient(to top, var(--accent-color) var(--bar-height), transparent var(--bar-height));
height: 100%;
&:hover {
height: 200%;
}
}
}

View File

@ -29,6 +29,7 @@
@use "not-found"; @use "not-found";
@use "post-nav"; @use "post-nav";
@use "pre-container"; @use "pre-container";
@use "sparkline";
@use "spoiler"; @use "spoiler";
@use "statements"; @use "statements";
@use "table"; @use "table";

View File

@ -14,6 +14,22 @@
{{ section.content | safe }} {{ section.content | safe }}
{# <div class="sparkline">
{%- if paginator.pages -%}
{%- set pages = paginator.pages -%}
{%- elif section.pages -%}
{%- set pages = section.pages -%}
{%- else -%}
{%- set pages = term.pages -%}
{%- endif -%}
{%- for month, pages in pages | group_by(attribute="month") -%}
{%- set posts_per_bar = pages | length -%}
{%- set bar_height = pages | length * 10 -%}
<div style="--bar-height: {{ bar_height ~ '%' }}" title="{{ macros_translate::translate(key='posts', number=posts_per_bar, default='$NUMBER posts in total', language_strings=language_strings) }}"></div>
{%- endfor -%}
</div> #}
<p> <p>
<small> <small>
{%- if config.taxonomies | length > 0 -%} {%- if config.taxonomies | length > 0 -%}
@ -22,7 +38,7 @@
</a> </a>
<br /> <br />
{%- endif %} {%- endif %}
{{ macros_translate::translate(key="posts", number=number_of_posts, default="$NUMBER posts", language_strings=language_strings) }} {{ macros_translate::translate(key="posts", number=number_of_posts, default="$NUMBER posts in total", language_strings=language_strings) }}
</small> </small>
</p> </p>