Skip to content

Commit

Permalink
feature(new-about-prof-picture): with different themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andebugulin committed Feb 14, 2025
1 parent 2c3e7e7 commit 2b98b99
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
30 changes: 21 additions & 9 deletions _layouts/about.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,30 @@ layout: default
<div class="profile float-{% if page.profile.align == 'left' %}left{% else %}right{% endif %}">
{% if page.profile.image %}
{% assign profile_image_path = page.profile.image | prepend: 'assets/img/' %}
{% assign profile_image_dark_path = page.profile.image_dark | prepend: 'assets/img/' %}

{% if page.profile.image_circular %}
{% assign profile_image_class = 'img-fluid z-depth-1 rounded-circle' %}
{% assign profile_image_class = 'img-fluid z-depth-1 rounded-circle profile-img' %}
{% else %}
{% assign profile_image_class = 'img-fluid z-depth-1
rounded' %}
{% assign profile_image_class = 'img-fluid z-depth-1 rounded profile-img' %}
{% endif %}
{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px)
30vw, 95vw"{% endcapture %}
{%
include figure.liquid loading="eager" path=profile_image_path class=profile_image_class sizes=sizes alt=page.profile.image
cache_bust=true
%}

{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px) 30vw, 95vw"{% endcapture %}

<img
src="{{ profile_image_path | relative_url }}"
class="{{ profile_image_class }} profile-img-light"
alt="profile picture"
sizes="{{ sizes }}"
loading="eager"
>
<img
src="{{ profile_image_dark_path | relative_url }}"
class="{{ profile_image_class }} profile-img-dark"
alt="profile picture"
sizes="{{ sizes }}"
loading="eager"
>
{% endif %}
{% if page.profile.more_info %}
<div class="more-info">{{ page.profile.more_info }}</div>
Expand Down
3 changes: 2 additions & 1 deletion _pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ subtitle:

profile:
align: right
image: prof_pic.png
image: prof_pic_light.png # Keep your original light theme image here
image_dark: prof_pic.png
image_circular: false # crops the image to make it circular
more_info: >
<p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>I am Andryha</p>
Expand Down
18 changes: 18 additions & 0 deletions _sass/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,21 @@ html[data-theme-setting="light"] {
display: block;
}
}


/* Default (light) theme */
.profile-img-light {
display: block;
}
.profile-img-dark {
display: none;
}

/* Dark theme */
html[data-theme="dark"] .profile-img-light {
display: none;
}

html[data-theme="dark"] .profile-img-dark {
display: block;
}
Binary file modified assets/img/prof_pic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/prof_pic_light.png
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 2b98b99

Please sign in to comment.