Skip to content

Commit 1864645

Browse files
Copilotgunndabad
andcommitted
Update header and footer generation for govuk-frontend v6 compatibility
Co-authored-by: gunndabad <2041280+gunndabad@users.noreply.github.com>
1 parent 7503bc2 commit 1864645

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

src/GovUk.Frontend.AspNetCore/ComponentGeneration/DefaultComponentGenerator.Footer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ public virtual Task<GovUkComponent> GenerateFooterAsync(FooterOptions options)
99
{
1010
ArgumentNullException.ThrowIfNull(options);
1111

12-
var footerTag = new HtmlTag("footer", attrs => attrs
12+
var footerTag = new HtmlTag("div", attrs => attrs
1313
.WithClasses("govuk-footer", options.Classes)
1414
.With(options.Attributes));
1515

1616
var containerTag = new HtmlTag("div", attrs => attrs
1717
.WithClasses("govuk-width-container", options.ContainerClasses));
1818

19-
if (options.Rebrand is true)
19+
containerTag.InnerHtml.AppendHtml(GenerateLogo(new LogoOptions
2020
{
21-
containerTag.InnerHtml.AppendHtml(GenerateLogo(new LogoOptions
22-
{
23-
Classes = "govuk-footer__crown",
24-
Rebrand = true,
25-
UseLogotype = false
26-
}));
27-
}
21+
Classes = "govuk-footer__crown",
22+
Rebrand = true,
23+
UseLogotype = false
24+
}));
2825

2926
if (options.Navigation is not null && options.Navigation.Count > 0)
3027
{

src/GovUk.Frontend.AspNetCore/ComponentGeneration/DefaultComponentGenerator.Header.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ public virtual Task<GovUkComponent> GenerateHeaderAsync(HeaderOptions options)
66
{
77
ArgumentNullException.ThrowIfNull(options);
88

9-
var rebrand = options.Rebrand ?? false;
109
var menuButtonText = options.MenuButtonText ?? "Menu";
1110

12-
var headerTag = new HtmlTag("header", attrs => attrs
11+
var headerTag = new HtmlTag("div", attrs => attrs
1312
.WithClasses("govuk-header", options.Classes)
14-
.With("data-module", "govuk-header")
1513
.With(options.Attributes));
1614

1715
var containerTag = new HtmlTag("div", attrs => attrs
@@ -36,15 +34,14 @@ HtmlTag CreateLogoSection()
3634
var logoDiv = new HtmlTag("div", attrs => attrs.WithClasses("govuk-header__logo"));
3735

3836
var logoLink = new HtmlTag("a", attrs => attrs
39-
.With("href", options.HomePageUrl ?? "/")
40-
.WithClasses("govuk-header__link", "govuk-header__link--homepage"));
37+
.With("href", options.HomePageUrl ?? "//gov.uk")
38+
.WithClasses("govuk-header__homepage-link"));
4139

4240
logoLink.InnerHtml.AppendHtml(GenerateLogo(new LogoOptions
4341
{
4442
Classes = "govuk-header__logotype",
4543
AriaLabelText = "GOV.UK",
46-
UseTudorCrown = options.UseTudorCrown,
47-
Rebrand = rebrand
44+
Rebrand = true
4845
}));
4946

5047
if (!options.ProductName.IsEmpty())

0 commit comments

Comments
 (0)