Skip to content

Commit

Permalink
Fix main-content-container to work with govuk-frontend columns
Browse files Browse the repository at this point in the history
This commit removes some of the rules that were previously set for the
`.main-content-container` and instead uses the column rules from
`govuk-frontend`.

The container has now been renamed as `contents-container` to be
consistent with the `contents-list-container`. I had hoped to remove
this class entirely, but it's required to apply different float rules
when in RTL reading mode.

This also adds the new class for collapsing columns to full width
when printing.
  • Loading branch information
matthillco committed Sep 17, 2024
1 parent cbbbf70 commit 9019d3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions app/assets/stylesheets/views/_html-publication.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,7 @@
}
}

.main-content-container {
width: 100%;
padding: 0 15px;
box-sizing: border-box;

@include govuk-media-query($from: desktop) {
width: 75%;
float: right;
}

.contents-container {
.direction-rtl & {
float: left;
}
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 @@ -46,7 +46,7 @@
<% end %>

<div id="contents">
<div class="govuk-grid-row">
<div class="govuk-grid-row gem-print-columns-none">
<% if @content_item.contents.any? %>
<div class="govuk-grid-column-one-quarter-from-desktop contents-list-container">
<%= render 'govuk_publishing_components/components/contents_list', contents: @content_item.contents, format_numbers: true %>
Expand All @@ -64,7 +64,7 @@
</div>
</div>

<div class="main-content-container<% unless @content_item.contents.any? %> offset-empty-contents-list<% end %>">
<div class="govuk-grid-column-three-quarters-from-desktop contents-container<% unless @content_item.contents.any? %> offset-empty-contents-list<% end %>">
<%= render "govuk_publishing_components/components/govspeak_html_publication", { direction: page_text_direction } do %>
<%= raw(@content_item.govspeak_body[:content]) %>
<% end %>
Expand Down

0 comments on commit 9019d3d

Please sign in to comment.