Skip to content

Commit

Permalink
Merge pull request #4595 from alphagov/remove-margin-top
Browse files Browse the repository at this point in the history
Remove margin_top option from shared helper
  • Loading branch information
andysellick authored Jan 28, 2025
2 parents c490dc4 + ab625b8 commit eb40487
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
10 changes: 0 additions & 10 deletions app/views/govuk_publishing_components/components/docs/title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,3 @@ examples:
margin_bottom: 0
context:
dark_background: true
using_design_system_template:
description: |
This option allows the removal of top margin from the component so that it works within a [Design System page template](https://design-system.service.gov.uk/styles/page-template/default/index.html), where spacing above the title is already provided by padding on the wrapping div.
embed: |
<main class="govuk-main-wrapper">
<%= component %>
</main>
data:
title: My page title
margin_top: 0
7 changes: 1 addition & 6 deletions lib/govuk_publishing_components/presenters/shared_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module GovukPublishingComponents
module Presenters
class SharedHelper
attr_reader :options, :margin_top, :margin_bottom, :heading_level, :classes
attr_reader :options, :margin_bottom, :heading_level, :classes

def initialize(local_assigns)
@options = local_assigns
@margin_top = @options[:margin_top] || nil
@margin_bottom = @options[:margin_bottom] || 3
@heading_level = @options[:heading_level] || 2

Expand All @@ -17,10 +16,6 @@ def initialize(local_assigns)
end
end

def get_margin_top
[*0..9].include?(@margin_top) ? "govuk-!-margin-top-#{margin_top}" : ""
end

def get_margin_bottom
[*0..9].include?(@margin_bottom) ? "govuk-!-margin-bottom-#{margin_bottom}" : "govuk-!-margin-bottom-3"
end
Expand Down

0 comments on commit eb40487

Please sign in to comment.