-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement a modern footer #400
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6dca628
Extract StructValue class for LinkBlock
mgax c4b62c7
Add footer columns
mgax 02def4c
Move social icons to footer
mgax 17d80df
Preview in Wagtail snippet editor
mgax 5be20a3
Tests for the footer
mgax 7f165d9
Responsive styling
mgax f85881a
Make the footer expansion accessible
mgax 5ecbf46
Make tests work after rebasing onto `main` branch
mgax 7ba5d73
Add wagtail-factories dependency
mgax 9b557a5
Improve accessibility
mgax 4865217
Add some comments
mgax c6a62c7
Merge branch 'feat/modern-footer' into feat/footer
kesara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Minor] Should we be allowing a column with no links?
[Minor] Also, if there's a maximum number of columns supported by the design, we should mention it here as help text, and add a
max_num
field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not a fan of making body content mandatory. No content editor will create an empty column and it doesn't really break anything. It just makes testing more annoying. Also, each column is a different snippet, so there's no good way to enforce a limit. But again, the content editor can make a judgement call for the number of columns, taking into account the length of the titles and link texts, and using the preview to see what it looks like.