Skip to content

Commit

Permalink
Update sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
kallioli committed Feb 19, 2024
1 parent 9be2568 commit 41602d6
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 11 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ theme_mode: light # [light | dark]
img_cdn:

# the avatar on sidebar, support local or CORS resources
avatar:
avatar: /assets/img/logo.svg

# The URL of the site-wide social preview image used in SEO `og:image` meta tag.
# It can be overridden by a customized `page.image` in front matter.
Expand Down
99 changes: 99 additions & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<!-- The Side Bar -->

<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
<header class="profile-wrapper">
<a href="{{ '/' | relative_url }}" id="avatar">
{%- if site.avatar != empty and site.avatar -%}
{%- capture avatar_url -%}
{% include img-url.html src=site.avatar %}
{%- endcapture -%}
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
{%- endif -%}
</a>

<h1 class="site-title">
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</h1>
<p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
</header>
<!-- .profile-wrapper -->

<nav class="flex-column flex-grow-1 w-100 ps-0">
<ul class="nav">
<!-- home -->
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link">
<i class="fa-fw fas fa-home"></i>
<span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span>
</a>
</li>
<!-- the real tabs -->
{% for tab in site.tabs %}
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link">
<i class="fa-fw {{ tab.icon }}"></i>
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}

<span>{{ site.data.locales[include.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
</a>
</li>
<!-- .nav-item -->
{% endfor %}
</ul>
</nav>

<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
{% unless site.theme_mode %}
<button type="button" class="mode-toggle btn" aria-label="Switch Mode">
<i class="fas fa-adjust"></i>
</button>

{% if site.data.contact.size > 0 %}
<span class="icon-border"></span>
{% endif %}
{% endunless %}

{% for entry in site.data.contact %}
{% case entry.type %}
{% when 'github', 'twitter' %}
{%- capture url -%}
https://{{ entry.type }}.com/{{ site[entry.type].username }}
{%- endcapture -%}
{% when 'email' %}
{% assign email = site.social.email | split: '@' %}
{%- capture url -%}
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
{%- endcapture -%}
{% when 'rss' %}
{% assign url = '/feed.xml' | relative_url %}
{% else %}
{% assign url = entry.url %}
{% endcase %}

{% if url %}
<a
href="{{ url }}"
aria-label="{{ entry.type }}"
{% assign link_types = '' %}

{% unless entry.noblank %}
target="_blank"
{% assign link_types = 'noopener noreferrer' %}
{% endunless %}

{% if entry.type == 'mastodon' %}
{% assign link_types = link_types | append: ' me' | strip %}
{% endif %}

{% unless link_types == empty %}
rel="{{ link_types }}"
{% endunless %}
>
<i class="{{ entry.icon }}"></i>
</a>
{% endif %}
{% endfor %}
</div>
<!-- .sidebar-bottom -->
</aside>
<!-- #sidebar -->
18 changes: 8 additions & 10 deletions _sass/addon/commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ html {
}

img {
max-width: 100%;

height: auto;
transition: all 0.35s ease-in-out;

Expand Down Expand Up @@ -715,32 +715,29 @@ html {
}

#avatar {
display: block;
display: flex;
width: 7rem;
height: 7rem;
overflow: hidden;
box-shadow: var(--avatar-border-color) 0 0 0 2px;
transform: translateZ(0); /* fixed the zoom in Safari */
width: 100%;

img {
transition: transform 0.5s;

&:hover {
transform: scale(1.2);
}
width: 100%;
}
}

.profile-wrapper {
@include mt-mb(2.5rem);
@extend %clickable-transition;

padding-left: 2.5rem;
padding-right: 1.25rem;
padding-left: 1.5rem;
padding-right: 1.5rem;
width: 100%;
}

.site-title {
display: none;
font-family: inherit;
font-weight: 900;
font-size: 1.75rem;
Expand All @@ -758,6 +755,7 @@ html {
}

.site-subtitle {
display: none;
font-size: 95%;
color: var(--site-subtitle-color);
margin-top: 0.25rem;
Expand Down
128 changes: 128 additions & 0 deletions assets/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 41602d6

Please sign in to comment.