Skip to content

Commit

Permalink
Add options to govspeak blocks for controlling vertical margins
Browse files Browse the repository at this point in the history
  • Loading branch information
matthillco committed Oct 18, 2024
1 parent c541786 commit ff254b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/views/landing_page/blocks/_govspeak.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<%-
margin_top = block.data["margin_top"]
margin_bot = block.data["margin_bottom"]

classes = ""
classes << "govuk-!-margin-top-#{margin_top} " if margin_top
classes << "govuk-!-margin-bottom-#{margin_bot} " if margin_bot
%>
<% if classes.present? %>
<div class="<%= classes %>">
<% end %>
<%= render "govuk_publishing_components/components/govspeak", { inverse: block.data["inverse"] } do %>
<%= block.data["content"].html_safe %>
<% end %>
<% if classes.present? %>
</div>
<% end %>
2 changes: 2 additions & 0 deletions lib/data/landing_page_content_items/landing_page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ blocks:
content: <p>Right content!</p>
- type: govspeak
content: <h2>Statistics</h2>
margin_top: 5
margin_bottom: 5
- type: hero
theme: middle_left
image:
Expand Down

0 comments on commit ff254b8

Please sign in to comment.