Skip to content

Commit 709db9c

Browse files
authored
Upcoming events and layout fixes (#761)
1 parent 314e4ad commit 709db9c

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

docs/en/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ BeeWare is supported by users like you! Every little bit helps: [click here to c
122122

123123
### Upcoming events
124124

125-
{{ upcoming_events(files) }}
125+
{% set events = upcoming_events(files) %}
126+
{% if events %}
127+
{{ events }}
128+
{% else %}
129+
130+
Nothing at the moment...
131+
132+
{% endif %}
126133

127134
### Documentation
128135

docs/en/stylesheets/beeware.css

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ md-path__list > .md-path__item > .md-path__link {
5959
margin-right: 6.7%;
6060
}
6161

62-
/* This forces all main content EXCEPT the index page to be 45rem wide */
63-
.md-sidebar--primary:is([hidden]) ~ .md-content:not(:has(.md-content__inner .index-page)) {
62+
/* This forces all main content EXCEPT the index and blog pages to be 45rem wide */
63+
/* The blog page includes the blog left sidebar in the width, and needs to be ignored */
64+
/* Docs page has its own width limits, and is ignored here. */
65+
.md-sidebar--primary:is([hidden]) ~ .md-content:not(:has(.index-page, .md-sidebar--post)) .md-content__inner:not(:has(.docs-page)),
66+
.md-post__content,
67+
.md-content--post > .md-content__inner {
6468
max-width: 45rem;
6569
}
6670

@@ -339,6 +343,11 @@ a.index-main-keep {
339343
min-width: 15rem;
340344
}
341345

346+
/* The right sidebar when not on blog pages */
347+
.md-sidebar--secondary:has(+ :not(.md-content--post)) {
348+
margin-right: 5.5%;
349+
}
350+
342351
h2#sidebar {
343352
margin-top: 0rem;
344353
}
@@ -537,6 +546,11 @@ h1 .news {
537546
width: 13rem;
538547
}
539548

549+
.md-content--post > .md-content__inner,
550+
.md-content__inner:has(.md-post) {
551+
margin-top: 1.8rem;
552+
}
553+
540554
.md-post__content h2:first-of-type {
541555
display: none;
542556
}
@@ -553,6 +567,7 @@ h1 .news {
553567
.md-sidebar--primary:is([hidden]) ~ .md-content.md-content--post {
554568
margin-left: 0;
555569
margin-right: 0;
570+
max-width: fit-content;
556571
}
557572

558573
@media screen and (min-width: 76.25em) {

docs/macros.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def upcoming_events(files):
268268
):
269269
metadata = get_metadata(file_data.content_string)
270270

271-
if metadata["event"]["date"] < datetime.date.today():
271+
if metadata["event"]["date"] > datetime.date.today():
272272
if metadata["event"]["date"] == metadata["event"]["end_date"]:
273273
event_date = metadata["event"]["date"].strftime("%B %d, %Y")
274274
else:
@@ -282,14 +282,14 @@ def upcoming_events(files):
282282
metadata["event"]["date"],
283283
(
284284
f"- [{metadata['event']['name']}"
285-
f": {event_date}]({file_data.src_path})",
285+
f": {event_date}]({file_data.src_path})"
286286
),
287287
)
288288
)
289289

290290
if events:
291291
return "\n".join(item[1] for item in sorted(events)[:5])
292-
return "Nothing at the moment..."
292+
return None
293293

294294
@env.macro
295295
def latest_news(files):

0 commit comments

Comments
 (0)