Skip to content

Commit

Permalink
Remove govuk- prefix from sticky-element
Browse files Browse the repository at this point in the history
We only use this prefix for styles coming from `govuk-frontend`
  • Loading branch information
alex-ju committed Feb 16, 2021
1 parent 08ee9ed commit 7acabf5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions app/assets/javascripts/modules/sticky-element-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
setInterval(checkScroll, _interval)
checkResize()
checkScroll()
$element.addClass('govuk-sticky-element--enabled')
$element.addClass('sticky-element--enabled')
}

function onResize () {
Expand Down Expand Up @@ -98,19 +98,19 @@
}

function stickToWindow () {
$element.addClass('govuk-sticky-element--stuck-to-window')
$element.addClass('sticky-element--stuck-to-window')
}

function stickToParent () {
$element.removeClass('govuk-sticky-element--stuck-to-window')
$element.removeClass('sticky-element--stuck-to-window')
}

function show () {
$element.removeClass('govuk-sticky-element--hidden')
$element.removeClass('sticky-element--hidden')
}

function hide () {
$element.addClass('govuk-sticky-element--hidden')
$element.addClass('sticky-element--hidden')
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
}

.app-c-contents-list-with-body__link-wrapper.govuk-sticky-element--stuck-to-window {
.app-c-contents-list-with-body__link-wrapper.sticky-element--stuck-to-window {
background-color: govuk-colour("light-grey", $legacy: "grey-3");
bottom: -1px; // 'Fix' for anomalous 1px margin which sporadically appears below this element.
left: 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.js-enabled .govuk-sticky-element {
.js-enabled .sticky-element {
position: absolute;
bottom: 0;

Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/views/_html-publication.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
display: none;
}

.govuk-sticky-element {
.govuk-sticky-element__print-link {
.sticky-element {
.sticky-element__print-link {
margin-left: govuk-spacing(3);
}
}

@include govuk-media-query($until: desktop) {
.govuk-sticky-element--enabled {
.sticky-element--enabled {
position: static;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/views/content_items/html_publication.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
<% end %>
</div>

<div data-sticky-element class="govuk-sticky-element">
<div data-sticky-element class="sticky-element">
<%= render 'components/back-to-top', href: "#contents" %>
<div class="govuk-sticky-element__print-link">
<div class="sticky-element__print-link">
<%= render "govuk_publishing_components/components/print_link", {
margin_top: 0,
margin_bottom: 6,
Expand Down
10 changes: 5 additions & 5 deletions spec/javascripts/modules/sticky-element-container.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('A sticky-element-container module', function () {
it('hides the element, when scrolled at the top', function () {
instance.start($element)

expect($footer.hasClass('govuk-sticky-element--hidden')).toBe(true)
expect($footer.hasClass('sticky-element--hidden')).toBe(true)
})

it('shows the element, stuck to the window, when scrolled in the middle', function () {
Expand All @@ -43,8 +43,8 @@ describe('A sticky-element-container module', function () {
}
instance.start($element)

expect($footer.hasClass('govuk-sticky-element--hidden')).toBe(false)
expect($footer.hasClass('govuk-sticky-element--stuck-to-window')).toBe(true)
expect($footer.hasClass('sticky-element--hidden')).toBe(false)
expect($footer.hasClass('sticky-element--stuck-to-window')).toBe(true)
})

it('shows the element, stuck to the parent, when scrolled at the bottom', function () {
Expand All @@ -55,8 +55,8 @@ describe('A sticky-element-container module', function () {
}
instance.start($element)

expect($footer.hasClass('govuk-sticky-element--hidden')).toBe(false)
expect($footer.hasClass('govuk-sticky-element--stuck-to-window')).toBe(false)
expect($footer.hasClass('sticky-element--hidden')).toBe(false)
expect($footer.hasClass('sticky-element--stuck-to-window')).toBe(false)
})
})
})
Expand Down

0 comments on commit 7acabf5

Please sign in to comment.