Skip to content

Commit 617b7fd

Browse files
author
Adrien Fabre
committed
Rework project page css
1 parent f676a20 commit 617b7fd

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed

src/_includes/css/pages/projects.css

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
/*
2-
* Check this site which seems to show what I want to do
3-
* https://blog.fullstackdigital.com/how-to-create-a-flawless-responsive-post-grid-with-flexbox-e5c7cc9d28e
4-
*/
5-
61
.projects-board {
72
display: flex;
83
flex-wrap: wrap;
9-
justify-content: space-between;
4+
justify-content: center;
5+
6+
/* Overflow from the body to be as large as the page */
7+
position: absolute;
8+
left: 0;
9+
right: 0;
10+
11+
gap: 10px 10px;
1012
}
1113

1214
.project-card {
@@ -18,9 +20,10 @@
1820
padding-top: 10px;
1921
margin: 10px;
2022

21-
/* By default two cards by row */
22-
/* Need a bit less of 50% because of the margin (I think) */
23-
width: 47%;
23+
width: 400px;
24+
25+
display: flex;
26+
flex-direction: column;
2427
}
2528

2629
/* On smaller screens 1 card by row */
@@ -31,42 +34,48 @@
3134
}
3235

3336
/* On mouse-over, add a deeper shadow */
34-
.project-card:hover {
35-
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.5);
36-
padding-top: 0px;
37-
}
38-
/* Trying to use active because hover doesn't work on mobile */
37+
/* Also using `active` because hover doesn't work on mobile */
38+
.project-card:hover,
3939
.project-card:active {
4040
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.5);
4141
padding-top: 0px;
42+
background: var(--nc-bg-2);
4243
}
4344

4445
/* On mouse-over, mark the name as clickable */
45-
.project-card:hover div h3 {
46-
color: var(--nc-lk-2);
47-
}
46+
.project-card:hover div h3 ,
4847
.project-card:active div h3 {
4948
color: var(--nc-lk-2);
5049
}
5150

5251
.project-img {
53-
width: 80%;
54-
height: 250px;
52+
width: 90%;
53+
height: 350px;
5554
transition: 0.3s;
5655
border-radius: 10px 10px 10px 10px;
5756
margin-bottom: auto;
5857
}
5958

60-
.project-card:hover .project-img {
61-
width: 100%
62-
}
59+
.project-card:hover .project-img,
6360
.project-card:active .project-img {
64-
width: 100%
61+
width: 100%;
62+
height: 360px;
6563
}
6664

6765
.text-overlay {
6866
padding: 2px 16px;
69-
border-radius: 0 0 10px 10px;
67+
68+
/* Make height 100% so that it spread until the bottom of the card
69+
* then use display flex and flex-grow: 50 on project-description so that
70+
* The code/demo/article links are aligned at the bottom of the cards
71+
*/
72+
height: 100%;
73+
display: flex;
74+
flex-direction: column;
75+
}
76+
77+
.project-description {
78+
flex-grow: 50;
7079
}
7180

7281
h3.project-title {

src/_includes/macros/projects.njk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
<a href="{{usedURL}}" target="_blank" rel="noopener noreferrer" data-goatcounter-click="project-{{usedURL}}" data-goatcounter-referrer="{{page.url}}">
1515
<h3 class="project-title">{{project.name}}</h3>
1616
</a>
17-
<p>{{project.description | safe}}</p>
18-
<p>
19-
{% if project.demo_url %}
20-
<a href="{{project.demo_url}}" target="_blank" rel="noopener noreferrer" data-goatcounter-click="project-{{project.demo_url}}" data-goatcounter-referrer="{{page.url}}">Demo</a>
21-
{% if project.code_url %} - {% endif %}
22-
{% endif %}
23-
17+
<p class="project-description">{{project.description | safe}}</p>
18+
<p class="project-links">
2419
{% if project.code_url %}
2520
<a href="{{project.code_url}}" target="_blank" rel="noopener noreferrer" data-goatcounter-click="project-{{project.code_url}}" data-goatcounter-referrer="{{page.url}}">Code</a>
21+
{% if project.demo_url or project.article_url %} - {% endif %}
22+
{% endif %}
23+
24+
{% if project.demo_url %}
25+
<a href="{{project.demo_url}}" target="_blank" rel="noopener noreferrer" data-goatcounter-click="project-{{project.demo_url}}" data-goatcounter-referrer="{{page.url}}">Demo</a>
2626
{% if project.article_url %} - {% endif %}
2727
{% endif %}
2828

0 commit comments

Comments
 (0)