-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#45] Block heading level accessibility
- Loading branch information
1 parent
8315cd9
commit c629657
Showing
5 changed files
with
41 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
{# @var \craft\elements\Entry|null block #} | ||
{% set block = block ?? null %} | ||
|
||
<div class="container"> | ||
<h2 class="text-4xl font-bold">{{ block.heading }}</h2> | ||
</div> | ||
{# @var bool hasPreviousBlocksWithH1 #} | ||
{% set hasPreviousBlocksWithH1 = hasPreviousBlocksWithH1 ?? false %} | ||
|
||
{% set element = hasPreviousBlocksWithH1 ? 'h2' : 'h1' %} | ||
|
||
{% tag element with { | ||
class: cx('container font-bold', { | ||
'text-4xl': not hasPreviousBlocksWithH1, | ||
'text-3xl': hasPreviousBlocksWithH1, | ||
}), | ||
} %} | ||
{{ block.heading }} | ||
{% endtag %} |
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,8 +1,12 @@ | ||
{# @var \craft\elements\Entry|null block #} | ||
{% set block = block ?? null %} | ||
|
||
{# @var bool hasPreviousBlocksWithH1 #} | ||
{% set hasPreviousBlocksWithH1 = hasPreviousBlocksWithH1 ?? false %} | ||
|
||
{{ include('_components/page-hero.twig', { | ||
image: block.image.eagerly().one(), | ||
title: block.title, | ||
description: block.richTextSimple, | ||
headingLevel: hasPreviousBlocksWithH1 ? 2 : 1, | ||
}) }} |
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