mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
13 hours ago 039de0cc607a6558ed8dd37bfdb884066ff54305
fix(footer): show the copyright on small screens

The copyright link used `dn dib-ns`, so it was hidden below 30em. Show
it at all widths, let the footer row wrap, and align the social icons
with the copyright when they wrap to their own row.

Add a browser test for the copyright at mobile and desktop widths.

Closes #449

Signed-off-by: Patrick Kollitsch <davidsneighbourdev+gh@gmail.com>
1 files modified
1 files added
26 ■■■■■ changed files
layouts/_partials/site-footer.html 6 ●●●●● patch | view | raw | blame | history
tests/e2e/footer.spec.ts 20 ●●●●● patch | view | raw | blame | history
layouts/_partials/site-footer.html
@@ -1,8 +1,8 @@
<footer class="{{ .Site.Params.background_color_class | compare.Default "bg-black" }} bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white white-70 dn dib-ns pv2 ph3 no-underline" href="{{ .Site.Home.Permalink }}" >
  <div class="flex flex-wrap justify-between">
  <a class="f4 fw4 hover-white white-70 dib pv2 ph3 no-underline" href="{{ .Site.Home.Permalink }}" >
    &copy; {{ with .Site.Copyright | compare.Default .Site.Title }} {{ . | safe.HTML }} {{ now.Format "2006"}} {{ end }}
  </a>
    <div>{{ partials.IncludeCached "social/follow.html" . }}</div>
    <div class="ph3 ph0-ns">{{ partials.IncludeCached "social/follow.html" . }}</div>
  </div>
</footer>
tests/e2e/footer.spec.ts
New file
@@ -0,0 +1,20 @@
import { expect, test } from "@playwright/test";
for (const width of [375, 1280]) {
  test(`footer shows the copyright at ${width}px (#449)`, async ({ page }) => {
    await page.setViewportSize({ width, height: 900 });
    await page.goto("/");
    const footer = page.getByRole("contentinfo");
    const copyright = footer.getByRole("link", { name: /©/ });
    await expect(copyright).toBeVisible();
    const footerBox = await footer.boundingBox();
    const linkBox = await copyright.boundingBox();
    expect(linkBox).not.toBeNull();
    expect(footerBox).not.toBeNull();
    if (linkBox && footerBox) {
      expect(linkBox.x + linkBox.width).toBeLessThanOrEqual(
        footerBox.x + footerBox.width,
      );
    }
  });
}