Skip to content

Commit

Permalink
Merge pull request #3774 from alphagov/kg-inverted-breadcrumbs-back-l…
Browse files Browse the repository at this point in the history
…inks

Add inverse breadcrumb and back link modifiers and styles
  • Loading branch information
querkmachine committed Jun 9, 2023
2 parents a346683 + 00e1072 commit c09c956
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/govuk/components/back-link/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,12 @@
bottom: -14px;
left: 0;
}

.govuk-back-link--inverse {
@include govuk-link-style-inverse;

&::before {
border-color: currentcolor;
}
}
}
4 changes: 4 additions & 0 deletions src/govuk/components/back-link/back-link.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ examples:
data:
href: '#'
text: Back to home
- name: with inverted colours
data:
classes: govuk-back-link--inverse
href: '#'

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
- name: classes
Expand Down
7 changes: 7 additions & 0 deletions src/govuk/components/back-link/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ describe('back-link component', () => {
expect($component.attr('data-test')).toEqual('attribute')
expect($component.attr('aria-label')).toEqual('Back to home')
})

it('renders with inverted colours if specified', () => {
const $ = render('back-link', examples['with inverted colours'])

const $component = $('.govuk-back-link')
expect($component.hasClass('govuk-back-link--inverse')).toBeTruthy()
})
})
12 changes: 12 additions & 0 deletions src/govuk/components/breadcrumbs/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,16 @@
}
}
}

.govuk-breadcrumbs--inverse {
color: govuk-colour("white");

.govuk-breadcrumbs__link {
@include govuk-link-style-inverse;
}

.govuk-breadcrumbs__list-item::before {
border-color: currentcolor;
}
}
}
10 changes: 10 additions & 0 deletions src/govuk/components/breadcrumbs/breadcrumbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ examples:
href: '/education'
- text: Special educational needs and disability (SEND) and high needs
href: '/education/special-educational-needs-and-disability-send-and-high-needs'
- name: with inverted colours
description: Breadcrumbs that appear on dark backgrounds
data:
classes: govuk-breadcrumbs--inverse
items:
- text: Home
href: '/'
- text: Passports, travel and living abroad
href: '/browse/abroad'
- text: Travel abroad

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
- name: classes
Expand Down
7 changes: 7 additions & 0 deletions src/govuk/components/breadcrumbs/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,12 @@ describe('Breadcrumbs', () => {
const $component = $('.govuk-breadcrumbs')
expect($component.hasClass('govuk-breadcrumbs--collapse-on-mobile')).toBeTruthy()
})

it('renders with inverted colours if specified', () => {
const $ = render('breadcrumbs', examples['with inverted colours'])

const $component = $('.govuk-breadcrumbs')
expect($component.hasClass('govuk-breadcrumbs--inverse')).toBeTruthy()
})
})
})

0 comments on commit c09c956

Please sign in to comment.