Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update usage of the title component #3918

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andysellick
Copy link
Contributor

@andysellick andysellick commented Dec 19, 2024

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

  • moving towards a world where the title component has no margin_top option: [DO NOT MERGE] Remove title component margin_top option govuk_publishing_components#4508
  • this removes instances of the use of the margin_top option for the title component
  • in some cases it was possible to replace the title component with the heading component for no visual change (where the margin_top: 0 option was applied)
  • in other cases there is a visual change, but this will be minimal

Why

We're updating the component spacing model to make it more consistent and having a margin_top option isn't part of the intended outcome.

Visual changes

For the coronavirus landing page the title component used the margin_top: 0 option, so we replace the component with the heading component, which means no visual change (app/views/coronavirus_landing_page/components/landing_page/_page_header.html.erb).

For the development index page we replace the title component with the heading component. This results in a small visual change, but this is a non-public facing page so isn't a concern (app/views/development/index.html.erb).

For the taxon pages the title component used the margin_top: 0 option, so we replace the component with the heading component, which means no visual change (app/views/taxons/_page_header.html.erb).

For the world location news pages the title component used the margin_top: 0 option, but requires the 'context' feature of the title component (not available in the heading component) so we keep it as it is, but remove the option (app/views/world_location_news/show.html.erb). This currently will not produce a visual difference until we merge alphagov/govuk_publishing_components#4508 at which point it will change as shown below (only on desktop and tablet, mobile remains unchanged). I think this change is acceptable, as the title seems quite squashed against the breadcrumb in this instance.

Before After
Screenshot 2024-12-19 at 16 20 19 Screenshot 2024-12-19 at 16 20 26

- moving towards a world where the title component has no margin_top option: alphagov/govuk_publishing_components#4508
- this removes instances of the use of the margin_top option for the title component
- in some cases it was possible to replace the title component with the heading component for no visual change (where the margin_top: 0 option was applied)
- in other cases there is a visual change, but this will be minimal
@govuk-ci govuk-ci temporarily deployed to collections-pr-3918 December 19, 2024 16:14 Inactive
@andysellick andysellick changed the title [DO NOT MERGE] Update usage of the title component Update usage of the title component Jan 7, 2025
@andysellick andysellick marked this pull request as ready for review January 7, 2025 10:44
@govuk-ci govuk-ci temporarily deployed to collections-pr-3918 January 8, 2025 10:38 Inactive
Copy link
Contributor

@MartinJJones MartinJJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me overall.

After looking further at the changes to the gem and other apps mentioned in the PR description, it appears that it was possible to swap most of the title components out with a heading component and the context option is only heavily used in collections.

I think this makes it a bit easier avoid adding the padding-top CSS to the title component for now as a workaround, as there are only a few apps left that may need to use the govuk-maim-wrapper class approach.

I've created a PR to do this in collections which also fixes several layout issues - #3944

If this could go live first, then it would mean that there are no visual changes in this PR and could make switching from the title component to the heading component, once the context variant has been added, a bit easier. What do you think about this idea/approach?

@andysellick
Copy link
Contributor Author

@MartinJJones happy for your PR to be merged first although I'd suggest if you're adding the margin_top: 0 option on the title component there it would be better to switch to the heading component instead. Heading now includes the context option and has no margin top. Also we're trying to retire the title component in favour of the heading component. Happy to discuss.

@MartinJJones
Copy link
Contributor

@andysellick I've merged the other PR now which makes better use of govuk-main-wrapper, replacing the title component with the heading component where required.

You should now be able to remove the change made to app/views/world_location_news/show.html.erb which would resolve the merge conflict and I think any visual changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants