Skip to content

Commit 0aa3821

Browse files
authored
Feat reworked project layout (closing cotes2020#2246) (cotes2020#2357)
The current state of project looks a bit unharmonized. # Vertical layout before: <img width="834" alt="Bildschirmfoto 2024-04-20 um 18 09 16" src="https://github.com/alshedivat/al-folio/assets/1998723/55ba0968-bfd9-443f-b58a-eb6723deccfc"> # Vertical layout after: <img width="834" alt="Bildschirmfoto 2024-04-20 um 18 10 28" src="https://github.com/alshedivat/al-folio/assets/1998723/9b06b9b8-9228-4dfd-ab10-ca16ce028b1d"> # Horizontal layout before: <img width="834" alt="Bildschirmfoto 2024-04-20 um 18 08 54" src="https://github.com/alshedivat/al-folio/assets/1998723/97aaf5b4-1d3e-4a1c-8175-3a97391739b3"> # Horizontal layout after: <img width="834" alt="Bildschirmfoto 2024-04-20 um 18 07 46" src="https://github.com/alshedivat/al-folio/assets/1998723/a357fa62-8551-4e92-91d3-3d5d01dbc605"> *** These improvements are not perfect, but to be honest, I have no deep experiences with bootstrap. Actually, I just read the [docs](https://getbootstrap.com/docs/4.4/components/card/) and tried my best. But I think it looks way better than before. I'm pretty happy with the vertical layout, but the horizontal could be improved. I tried various things to get a better alignment of the image, without any success. In theroy, there is e.g. `card-img-top`, but I could not make it work. I changed the project descriptions to make some of these edge-cases visible. Feedback and improvements (especially code) are more than welcome Closes cotes2020#2246
1 parent c4c0665 commit 0aa3821

File tree

7 files changed

+21
-40
lines changed

7 files changed

+21
-40
lines changed

_includes/projects.liquid

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<div class="grid-sizer"></div>
2-
<div class="grid-item">
1+
<div class="col">
32
<a href="{% if project.redirect %}{{ project.redirect }}{% else %}{{ project.url | relative_url }}{% endif %}">
4-
<div class="card hoverable">
3+
<div class="card h-100 hoverable">
54
{% if project.img %}
65
{%
76
include figure.liquid
87
loading="eager"
98
path=project.img
109
sizes = "250px"
1110
alt="project thumbnail"
11+
class="card-img-top"
1212
%}
1313
{% endif %}
1414
<div class="card-body">
15-
<h2 class="card-title text-lowercase">{{ project.title }}</h2>
15+
<h2 class="card-title">{{ project.title }}</h2>
1616
<p class="card-text">{{ project.description }}</p>
1717
<div class="row ml-1 mr-1 p-0">
1818
{% if project.github %}

_includes/projects_horizontal.liquid

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<div class="card-item col">
1+
<div class="col mb-4">
22
<a href="{% if project.redirect %}{{ project.redirect }}{% else %}{{ project.url | relative_url }}{% endif %}">
3-
<div class="card hoverable">
4-
<div class="row g-0">
3+
<div class="card h-100 hoverable">
4+
<div class="row no-gutters">
55
{% if project.img %}
6-
<div class="card-img col-md-6">
7-
{% include figure.liquid loading="eager" path=project.img sizes="(min-width: 768px) 156px, 50vw" alt="project thumbnail" %}
6+
<div class="col-md-6">
7+
{% include figure.liquid loading="eager" path=project.img sizes="(min-width: 768px) 156px, 50vw" alt="project thumbnail" class="card-img" %}
88
</div>
99
{% endif %}
1010
<div class="{% if project.img %}col-md-6{% else %}col-md-12{% endif %}">
1111
<div class="card-body">
12-
<h3 class="card-title text-lowercase">{{ project.title }}</h3>
12+
<h3 class="card-title">{{ project.title }}</h3>
1313
<p class="card-text">{{ project.description }}</p>
1414
<div class="row ml-1 mr-1 p-0">
1515
{% if project.github %}

_pages/blog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pagination:
6464
{% assign is_even = featured_posts.size | modulo: 2 %}
6565
<div class="row row-cols-{% if featured_posts.size <= 2 or is_even == 0 %}2{% else %}3{% endif %}">
6666
{% for post in featured_posts %}
67-
<div class="card-item col">
67+
<div class="col mb-4">
6868
<a href="{{ post.url | relative_url }}">
6969
<div class="card hoverable">
7070
<div class="row g-0">

_pages/projects.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ horizontal: false
2222
<!-- Generate cards for each project -->
2323
{% if page.horizontal %}
2424
<div class="container">
25-
<div class="row row-cols-2">
25+
<div class="row row-cols-1 row-cols-md-2">
2626
{% for project in sorted_projects %}
2727
{% include projects_horizontal.liquid %}
2828
{% endfor %}
2929
</div>
3030
</div>
3131
{% else %}
32-
<div class="grid">
32+
<div class="row row-cols-1 row-cols-md-3">
3333
{% for project in sorted_projects %}
3434
{% include projects.liquid %}
3535
{% endfor %}
@@ -48,14 +48,14 @@ horizontal: false
4848
{% if page.horizontal %}
4949

5050
<div class="container">
51-
<div class="row row-cols-2">
51+
<div class="row row-cols-1 row-cols-md-2">
5252
{% for project in sorted_projects %}
5353
{% include projects_horizontal.liquid %}
5454
{% endfor %}
5555
</div>
5656
</div>
5757
{% else %}
58-
<div class="grid">
58+
<div class="row row-cols-1 row-cols-md-3">
5959
{% for project in sorted_projects %}
6060
{% include projects.liquid %}
6161
{% endfor %}

_projects/1_project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: page
33
title: project 1
4-
description: a project with a background image
4+
description: with background image
55
img: assets/img/12.jpg
66
importance: 1
77
category: work

_projects/3_project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: page
3-
title: project 3
3+
title: project 3 with very long name
44
description: a project that redirects to another website
55
img: assets/img/7.jpg
66
redirect: https://unsplash.com

_sass/_base.scss

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,17 @@ ul.task-list input[type="checkbox"] {
164164
.card {
165165
background-color: var(--global-card-bg-color);
166166

167-
img {
167+
.card-img {
168168
width: 100%;
169+
padding-top: 1.25rem;
169170
}
170171

171172
.card-title {
172173
color: var(--global-text-color);
173174
}
174175

175-
.card-item {
176-
width: auto;
177-
margin-bottom: 10px;
178-
179-
.row {
180-
display: flex;
181-
align-items: center;
182-
}
176+
.card-body {
177+
padding: 1.25rem 1.25rem 0 1.25rem;
183178
}
184179
}
185180

@@ -628,16 +623,6 @@ footer.sticky-bottom {
628623
}
629624
}
630625

631-
.card-item {
632-
width: auto;
633-
margin-bottom: 10px;
634-
635-
.row {
636-
display: flex;
637-
align-items: center;
638-
}
639-
}
640-
641626
.grid-sizer,
642627
.grid-item {
643628
width: 250px;
@@ -1087,10 +1072,6 @@ nav[data-toggle="toc"] {
10871072
}
10881073
}
10891074

1090-
.card-item {
1091-
margin-bottom: 10px;
1092-
}
1093-
10941075
.post-meta {
10951076
color: var(--global-text-color-light);
10961077
font-size: 0.875rem;

0 commit comments

Comments
 (0)