Skip to content

Commit 6f844c3

Browse files
committed
fix(css): home grid alignment fixes
1 parent 561288d commit 6f844c3

File tree

3 files changed

+172
-96
lines changed

3 files changed

+172
-96
lines changed

_includes/feature_row_pyos

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
{% assign feature_row = page.feature_row %}
55
{% endif %}
66

7-
<div class="grid col-3">
7+
<div class="feature-grid">
8+
89
{% for f in feature_row %}
10+
<div class="grid-item">
911
<div class="cards highlight">
1012
{% if f.image_path %}
11-
<div class="cards__image">
13+
<div class="cards-image">
1214
<img src="{{ f.image_path | relative_url }}"
1315
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
1416
{% if f.image_caption %}
@@ -17,23 +19,22 @@
1719
</div>
1820
{% endif %}
1921
<div class="card-body">
20-
<div>
2122
{% if f.title %}
2223
<h2 class="card-title">{{ f.title }}</h2>
2324
{% endif %}
2425

2526
{% if f.excerpt %}
26-
<div class="archive__item-excerpt">
27+
<div class="card-content">
2728
{{ f.excerpt | markdownify }}
2829
</div>
2930
{% endif %}
30-
31-
{% if f.url %}
32-
<p><a href="{{ f.url | relative_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
33-
{% endif %}
34-
</div>
31+
<div class="card-footer">
32+
{% if f.url %}
33+
<a href="{{ f.url | relative_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a>
34+
{% endif %}
35+
</div>
3536
</div>
3637
</div>
38+
</div>
3739
{% endfor %}
38-
3940
</div>

_pages/home.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ peer-review:
2929
title: "Community Partnerships"
3030
excerpt: "We partner with domain-specific scientific Python communities such as [Pangeo](https://www.pyopensci.org/software-peer-review/partners/pangeo.html) who want to review affiliated packages. Through this collaboration, we develop community-specific standards that are used in our reviews to evaluate whether a package meets affiliation requirements. This removes the need for communities to develop their own peer review process."
3131
url: https://www.pyopensci.org/partners.html
32-
btn_label: "> Learn More About Our Community Partners"
32+
btn_label: "> Learn About Community Partners"
3333
btn_class: btn--inverse
3434
- image_path: images/python-packaging-guide.png
3535
title: "Simplifying Packaging"
3636
alt: Light purple image that says python packaging guide and below it says simplifying python packaging. The background is a grey laptop with a hand looking down at the laptop the above.
3737
excerpt: "We are creating a beginner-friendly, **community-driven Python packaging guide**. Our guide is reviewed by members of the Python Packaging Authority, maintainers of core packaging tools and members of the scientific Python community. It recommends best practices for you to follow when creating a Python package."
3838
url: https://www.pyopensci.org/python-package-guide/
39-
btn_label: "> Check out our Python packaging guide"
39+
btn_label: "> Read our packaging guide"
4040
btn_class: btn--inverse
4141
---
4242

@@ -89,11 +89,11 @@ peer-review:
8989
<div class="notice notice-highlight" markdown="1">
9090
## Recent blog posts & updates
9191

92-
<div class="grid col-3">
92+
<div class="grid">
9393
{% for post in blog_posts limit:3 %}
9494

9595
<div class="cards">
96-
<h3 ><a href="{{ site.baseurl }}{{ post.url}}" rel="permalink">{{ post.title }}</a></h3>
96+
<h3 class="card-title"><a href="{{ site.baseurl }}{{ post.url}}" rel="permalink">{{ post.title }}</a></h3>
9797

9898
<div>
9999
<p>{{ post.excerpt | markdownify }}</p>

_sass/minimal-mistakes/_pyos-grid.scss

Lines changed: 157 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $colors: (
2424

2525

2626
// Include the mixin
27-
@include generate-color-styles($colors);
27+
//@include generate-color-styles($colors);
2828

2929

3030
.clearfix::after {
@@ -70,10 +70,16 @@ $colors: (
7070
}
7171
}
7272

73-
73+
.grid-item {
74+
background: #f9f9f9;
75+
border: 1px solid #ddd;
76+
border-radius: 8px;
77+
overflow: hidden;
78+
display: flex;
79+
flex-direction: column;
80+
}
7481

7582
/* Blog grid styles */
76-
7783
.blog__grid {
7884
display: grid;
7985
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
@@ -113,10 +119,7 @@ $colors: (
113119
}
114120
}
115121

116-
/* Package cards splash */
117-
.cards h2.archive__item-title {
118-
font-size: 1.1em!important;
119-
}
122+
120123

121124
.bubble:before {
122125
content: "";
@@ -135,113 +138,185 @@ $colors: (
135138

136139
// Cards are also used to style the isotope layout
137140
// do not adjust the display or structure of the cards element.
141+
/* Package cards splash */
138142
.cards {
139-
top: 0px;
140-
position: relative;
141-
background-color: #fcfbf5;;
142-
border-radius: 4px;
143-
text-decoration: none;
144-
z-index: 0;
143+
top: 0px;
144+
position: relative;
145+
background-color: #fcfbf5;
146+
border-radius: 4px;
147+
text-decoration: none;
148+
z-index: 0;
149+
overflow: hidden;
150+
border: 1px solid #ccc;
151+
font-size: .8em;
152+
153+
@include breakpoint-max-width(480px) {
154+
padding: 2em;
155+
}
156+
157+
&__image {
158+
max-height: calc($small / 3);
145159
overflow: hidden;
146-
border: 1px solid #ccc;
147-
font-size: .8em;
160+
border-radius: 10px;
161+
}
148162

149-
@include breakpoint-max-width(480px) {
150-
.cards {
151-
padding: 2em;
152-
}
153-
}
163+
&:hover {
164+
transition: all 0.2s ease-out;
165+
box-shadow: 0px 4px 8px rgba(38, 38, 38, 0.2);
166+
top: -4px;
167+
border: 1px solid #cccccc;
168+
background-color: white;
169+
cursor: pointer;
170+
}
154171

155-
&__image {
156-
max-height: calc($small/3);
157-
overflow: hidden;
158-
border-radius: 10px;
172+
&:hover:before {
173+
transform: scale(2.15);
174+
}
175+
176+
p {
177+
font-size: .9em;
178+
}
179+
180+
h2 {
181+
a {
182+
text-decoration: none;
183+
font-size: 1.2em;
159184
}
160185

161-
&.highlight div {
162-
padding:0;
186+
&.archive__item-title {
187+
font-size: 1.1em !important;
163188
}
189+
}
164190

165-
&.highlight {
166-
background-color:#f0f0f0!important;
167-
padding: 0;
191+
h3.card__title.no_toc,
192+
.card__title.no_toc {
193+
margin-top: .3em;
194+
font-size: 1.5em;
195+
color: #320a44;
196+
}
168197

169-
&:before {
170-
background-color: #fff;
171-
}
198+
.page__meta.contributors {
199+
font-size: .7em;
200+
}
172201

173-
&:hover {
174-
cursor:default;
175-
}
202+
.contributors a {
203+
text-decoration: none;
204+
}
176205

206+
ul {
207+
font-size: .8em;
208+
list-style-type: none;
209+
margin-left: 0;
210+
padding: .2em;
211+
}
177212

178-
.card-body {
179-
margin: .2em;
180-
padding: 1.2em;
213+
ul a {
214+
text-decoration: none;
215+
}
216+
}
181217

182-
p {
183-
font-size: 1.2em;
184-
}
218+
.grid h3.card-title a {
219+
margin-top: .3em;
220+
font-size: 1.3em;
221+
color: $pyos-darkpurple;
222+
margin-top: 0;
223+
margin-bottom: 0;
224+
border-bottom: none;
225+
}
185226

186-
.card-title {
187-
margin-top: 0;
188-
margin-bottom: 0;
189-
border-bottom: none;
190-
}
191-
}
192-
}
227+
.feature-grid {
228+
display: grid;
229+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
230+
gap: 20px;
231+
//padding: 20px;
232+
width: 100%;
233+
box-sizing: border-box;
193234

194-
&:hover {
195-
transition: all 0.2s ease-out;
196-
box-shadow: 0px 4px 8px rgba(38, 38, 38, 0.2);
197-
top: -4px;
198-
border: 1px solid #cccccc;
199-
background-color: white;
200-
cursor: pointer;
201-
}
235+
.grid-item {
236+
display: flex;
237+
flex-direction: column;
238+
background: #f9f9f9;
239+
border: 1px solid #ddd;
240+
border-radius: 8px;
241+
overflow: hidden;
242+
}
202243

203244

204-
&:hover:before {
205-
transform: scale(2.15);
206-
}
245+
div>div {
246+
padding:0;
247+
}
248+
}
207249

208-
p {
209-
font-size: .9em
250+
// Highlight is used for the home page highlight feature cards
251+
.cards.highlight {
252+
display: flex;
253+
flex-direction: column;
254+
height: 100%;
255+
256+
.cards__image {
257+
max-height: 200px;
258+
overflow: hidden;
259+
260+
img {
261+
width: 100%;
262+
height: auto;
263+
object-fit: cover;
210264
}
265+
}
211266

212-
h2 a {
213-
text-decoration: none;
214-
font-size: 1.2em;
267+
&:before {
268+
background-color: #fff;
269+
}
270+
271+
&:hover {
272+
cursor: default;
273+
}
274+
275+
.card-body {
276+
display: flex;
277+
flex-direction: column;
278+
flex-grow: 1;
279+
padding: 15px;
280+
281+
h2.card-title {
282+
margin:0;
215283
}
216284

217-
h3.card__title.no_toc, .card__title.no_toc {
218-
margin-top: .3em;
219-
font-size: 1.5em;
220-
color: #320a44;
285+
.card-content {
286+
flex-grow: 1;
221287
}
222288

223-
.page__meta.contributors {
224-
font-size: .7em;
289+
.card-footer {
290+
padding: 15px;
291+
text-align: center;
292+
293+
a.btn {
294+
margin-top: auto
295+
}
225296
}
226297

227-
.contributors a {
228-
text-decoration: none;
298+
/* Ensure content is spaced properly and button stays at the bottom */
299+
> div {
300+
display: flex;
301+
flex-direction: column;
302+
flex-grow: 1;
303+
justify-content: space-between; /* Distribute content vertically */
229304
}
230305

231-
ul {
232-
font-size: .8em;
233-
list-style-type: none;
234-
margin-left: 0;
235-
padding: .2em;
306+
/* Style for the p containing the button */
307+
p {
308+
font-size: 1.2em;
309+
margin-bottom: 0.5em;
236310
}
237311

238-
ul a {
239-
text-decoration: none;
312+
/* Ensure the button is pushed to the bottom */
313+
p a.btn {
314+
margin-top: auto; /* This ensures the button stays at the bottom */
315+
border: 1px solid yellow;
316+
align-self: flex-start; /* Optional, to align the button to the left */
240317
}
241318
}
242-
243-
244-
319+
}
245320
/* Blog & event grid styles*/
246321

247322
.blog__grid .cards {

0 commit comments

Comments
 (0)