-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement a modern footer (#400)
* Extract StructValue class for LinkBlock * Add footer columns * Move social icons to footer * Preview in Wagtail snippet editor * Tests for the footer * Responsive styling * Make the footer expansion accessible * Make tests work after rebasing onto `main` branch * Add wagtail-factories dependency * Improve accessibility * Add some comments --------- Co-authored-by: Kesara Rathnayake <[email protected]>
- Loading branch information
Showing
17 changed files
with
325 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ $custom-spacers: ( | |
); | ||
|
||
$spacers: map-merge($spacers, $custom-spacers); | ||
|
||
$enable-negative-margins: true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,64 @@ | ||
<footer class="bg-dark text-light py-1"> | ||
<div class="container"> | ||
<ul class="nav row"> | ||
{% for item in settings.utils.FooterLinks.footer_link_items.all %} | ||
<li class="nav-item col-6 col-lg-auto"><a class="nav-link text-light" href="{{ item.link }}">{{ item.title }}</a></li> | ||
<div class="container my-5"> | ||
<div class="row"> | ||
{% for column in FOOTER %} | ||
<section class="col-lg"> | ||
<div class="border-bottom u-border-lg-bottom-0 border-light border-opacity-50"> | ||
<h4 class="my-0 py-4 fs-6" role="button" aria-expanded="false"> | ||
{{ column.title }} | ||
<i class="bi bi-chevron-down"></i> | ||
</h4> | ||
<ul class="list-unstyled opacity-75"> | ||
{% for link in column.links %} | ||
{% if link.value.url and link.value.text %} | ||
<li class="nav-item"> | ||
<a | ||
href="{{ link.value.url }}" | ||
class="link-underline-opacity-0 link-light fw-semibold lh-lg" | ||
> | ||
{{ link.value.text }} | ||
</a> | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</section> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="container my-5"> | ||
<div class="d-lg-flex justify-content-between align-items-start lh-1"> | ||
<div class="d-flex fs-4 my-5 my-lg-0 ms-n2 my-5 me-3"> | ||
{% for item in SOCIAL_MENU %} | ||
<a class="d-block text-light px-2" href="{{ item.url }}" rel="me"> | ||
<i class="bi bi-{{ item.icon }}"></i> | ||
</a> | ||
{% endfor %} | ||
</div> | ||
<ul class=" | ||
row gx-0 column-gap-5 row-gap-3 justify-content-lg-end | ||
my-5 my-lg-0 | ||
nav opacity-75 | ||
"> | ||
{% for item in settings.utils.FooterLinks.footer_link_items.all %} | ||
<li class="nav-item col-auto py-0"> | ||
<a href="{{ item.link }}" class="nav-link text-light fs-10 p-0"> | ||
{{ item.title }} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> | ||
</footer> | ||
|
||
<script> | ||
[... document.querySelectorAll("footer section")].forEach((section) => { | ||
const heading = section.querySelector("h4"); | ||
heading.addEventListener("click", () => { | ||
const expanded = section.classList.toggle("expanded"); | ||
heading.setAttribute("aria-expanded", expanded); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
footer section { | ||
h4[role=button] { | ||
@include media-breakpoint-up(lg) { | ||
cursor: text; | ||
} | ||
} | ||
|
||
h4 .bi-chevron-down { | ||
display: block; | ||
float: right; | ||
@include media-breakpoint-up(lg) { | ||
display: none; | ||
} | ||
} | ||
|
||
&.expanded h4 .bi-chevron-down { | ||
transform: rotate(180deg); | ||
} | ||
|
||
ul { | ||
display: none; | ||
@include media-breakpoint-up(lg) { | ||
display: block; | ||
} | ||
} | ||
|
||
&.expanded ul { | ||
display: block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@import 'header.scss'; | ||
@import 'footer.scss'; | ||
|
||
.block-paragraph { | ||
.h2, h2 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.7 on 2024-03-29 14:06 | ||
|
||
from django.db import migrations, models | ||
import wagtail.blocks | ||
import wagtail.fields | ||
import wagtail.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('utils', '0009_megamenu'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='FooterColumn', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=255)), | ||
('links', wagtail.fields.StreamField([('link', wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Page', required=False)), ('title', wagtail.blocks.CharBlock(label='Link text', required=False)), ('external_url', wagtail.blocks.URLBlock(label='External URL', required=False))]))], blank=True, use_json_field=True)), | ||
('sort_order', models.PositiveSmallIntegerField()), | ||
], | ||
options={ | ||
'ordering': ['sort_order'], | ||
}, | ||
bases=(wagtail.models.PreviewableMixin, models.Model), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% extends settings.utils.LayoutSettings.base_template %} |
Oops, something went wrong.