Skip to content

Commit

Permalink
Add a way to debug information of a post by hovering over it (#25)
Browse files Browse the repository at this point in the history
This information only exists while developing locally.
  • Loading branch information
Garanas authored Feb 25, 2025
1 parent 09e4720 commit eff7ec8
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 52 deletions.
58 changes: 36 additions & 22 deletions src/_includes/post/featured.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,46 @@
- post: an instance of a post
{% endcomment %}

<div class="post-card post-debug-container">
<div class="post-featured-container">
<div class="post-featured-item-container post-card">
<div class="post-featured-image-container">
{% include components/thumbnail.html path=include.post.image.path alt=include.post.image.alt %}

<div class="post-featured-item-container post-card">
<div class="post-featured-image-container">
{% include components/thumbnail.html path=include.post.image.path alt=include.post.image.alt %}
{%- if include.post.event -%}
<span class="post-featured-meta">
{% include post/event/schedule.html event=include.post.event %}
</span>
{%- endif -%}
</div>
<div class="post-featured-text-container">
<h3 class="post-featured-header">{{ include.post.title | escape }}</h3>

{%- if include.post.event -%}
<span class="post-featured-meta">
{% include post/event/schedule.html event=include.post.event %}
</span>
{%- endif -%}
{% comment %}
We can only support so many characters in the overview, therefore we truncate it.
{% endcomment %}

<span class="post-featured-excerpt">
{{ include.post.excerpt | strip_html | truncate: 600 }}
</span>

<div class="post-featured-actions">
{% assign absolute_url_post = include.post.url | absolute_url %}
{% include components/copy-button.html title=include.post.title description=include.post.excerpt url=absolute_url_post %}
{% include components/url-button.html href=include.post.redirectURL %}
</div>
</div>
</div>
</div>
<div class="post-featured-text-container">
<h3 class="post-featured-header">{{ include.post.title | escape }}</h3>

{% comment %}
We can only support so many characters in the overview, therefore we truncate it.
{% endcomment %}
{% if jekyll.environment != "production" %}

<span class="post-featured-excerpt">
{{ include.post.excerpt | strip_html | truncate: 600 }}
</span>
{% comment %}
This part is only shown while developing
{% endcomment %}

<div class="post-featured-actions">
{% assign absolute_url_post = include.post.url | absolute_url %}
{% include components/copy-button.html title=include.post.title description=include.post.excerpt url=absolute_url_post %}
{% include components/url-button.html href=include.post.redirectURL %}
<div class="post-debug-content">
<p>Priority: {{ include.post.priority | default: 'unknown' }}</p>
</div>
</div>
</div>
{% endif %}
</div>
64 changes: 38 additions & 26 deletions src/_includes/post/small.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,53 @@
- post: an instance of a post
{% endcomment %}

<div class="post-small-image-container">
<div class="post-small-image-picture">
{% include components/thumbnail.html path=include.post.image.path alt=include.post.image.alt %}
</div>

<div class="post-card post-debug-container">
<div class="post-small-item-container">
<div class="post-small-image-container">
<div class="post-small-image-picture">
{% include components/thumbnail.html path=include.post.image.path alt=include.post.image.alt %}
</div>

<span class="post-small-image-meta">
<div class="post-small-image-meta-schedule">
<div class="post-small-image-meta">
{%- if include.post.event -%}
{% include post/event/schedule.html event=include.post.event %}
<div class="post-small-image-meta-schedule">
{% include post/event/schedule.html event=include.post.event %}
</div>
{%- endif -%}
</div>

<div class="post-small-image-meta-actions">
{% include components/copy-button.html title=include.post.title description=include.post.excerpt url=include.post.url %}
<div class="post-small-image-meta-actions">
{% include components/copy-button.html title=include.post.title description=include.post.excerpt url=include.post.url %}
</div>
</div>
</span>
</div>

</div>
<div class="post-small-text-container">
<div class="post-small-text-body-container">
<h3 class="post-small-header">{{ include.post.title | escape }}</h3>

<div class="post-small-text-container">
<div class="post-small-text-body-container">
<h3 class="post-small-header">{{ include.post.title | escape }}</h3>
{% comment %}
We can only support so many characters in the overview, therefore we truncate it.
{% endcomment %}

{% comment %}
We can only support so many characters in the overview, therefore we truncate it.
{% endcomment %}
<p class="post-small-excerpt">
{{ include.post.excerpt | strip_html | truncate: 600 }}
</p>
</div>

<p class="post-small-excerpt">
{{ include.post.excerpt | strip_html | truncate: 600 }}
</p>
<div class="post-small-actions">
{% include components/url-button.html href=include.post.redirectURL %}
</div>
</div>
</div>

<div class="post-small-actions">
{% if jekyll.environment != "production" %}

{% include components/url-button.html href=include.post.redirectURL %}
</div>
</div>
{% comment %}
This part is only shown while developing
{% endcomment %}

<div class="post-debug-content">
<p>Priority: {{ include.post.priority | default: 'unknown' }}</p>
</div>
{% endif %}
</div>
2 changes: 1 addition & 1 deletion src/_layouts/category_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<section class="wrapper">
<ul class="post-small-item-list-container">
{% for post in page.posts %}
<li class="post-small-item-container post-card">
<li>
{% include post/small.html post=post %}
</li>
{% endfor %}
Expand Down
1 change: 1 addition & 0 deletions src/_sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $code-font-family: "Menlo", "Inconsolata", "Consolas", "Roboto Mono", "Ubuntu Mo
$base-font-size: 16px !default;
$base-font-weight: 400 !default;
$small-font-size: $base-font-size * 0.875 !default;
$mini-font-size: $base-font-size * 0.650 !default;
$base-line-height: 1.5 !default;

$spacing-unit: 30px !default;
Expand Down
32 changes: 32 additions & 0 deletions src/_sass/post/_common.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
.post-card {
height: 100%;

box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
border: 1px solid var(--minima-border-color-01);
border-radius: 4px;
background-color: var(--minima-card-background-color);
}

// ------------------------------------------------------------------------- \\
// Debugging functionality

.post-debug-container {
position: relative; /* Needed for absolute positioning of tooltip */
}

.post-debug-content {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);

background: rgba(0, 0, 0, 0.8);
color: white;
padding: 0.5em;
border-radius: 5px;
font-size: 0.8rem;
white-space: nowrap;

opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease-in-out;
}

.post-debug-container:hover .post-debug-content {
opacity: 1;
visibility: visible;
}
2 changes: 2 additions & 0 deletions src/_sass/post/_small.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
flex-wrap: wrap;
align-content: flex-start;
gap: 0.5rem 1rem;

height: 100%;

&:focus-within {
border: 1px solid var(--minima-border-color-02);
Expand Down
4 changes: 1 addition & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@

<section class="wrapper wrapper-body">
<section class="top-container">
<div class="post-featured-container">
{%- if featuredLivePosts.size > 0 -%}
{% assign featuredLivePost = featuredLivePosts | first %}
{% include post/featured.html post=featuredLivePost %}
{%- endif -%}
</div>
<div class="post-event-container ">
<ul class="post-event-list post-card">
{%- for postEvent in eventLivePosts -%}
Expand All @@ -46,7 +44,7 @@ <h4 class="post-event-header">Want to see your event here? Inform the promotions
{%- if regularLivePosts.size > 0 -%}
<ul class="post-small-item-list-container">
{%- for post in regularLivePosts -%}
<li class="post-small-item-container post-card">
<li>
{% include post/small.html post=post %}
</li>
{%- endfor -%}
Expand Down

0 comments on commit eff7ec8

Please sign in to comment.