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 title component to meet chosen conventions #1117

Merged
merged 2 commits into from
Aug 24, 2017

Conversation

vanitabarrett
Copy link
Contributor

Updating static title component to meet government-frontend component conventions.
This includes:

  • Using pub-c namespace for CSS classes
  • Use of BEM
  • Adding accessibility criteria to docs

screen shot 2017-08-21 at 09 49 50

screen shot 2017-08-21 at 09 50 03

@vanitabarrett vanitabarrett force-pushed the refactor-title-component branch 2 times, most recently from 5469148 to 71356f9 Compare August 21, 2017 08:56
Copy link
Contributor

@NickColley NickColley left a comment

Choose a reason for hiding this comment

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

Looking good just a few nits sorry 👍

.context {
@include core-24;
color: $secondary-text-colour;
&--long .pub-c-title__text {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems as if here, since the long modifier only impacts the text element, we could have a modifier class on .pub-c-title_text instead?

@@ -2,9 +2,9 @@
average_title_length ||= :average
context ||= false
%>
<div class="govuk-title length-<%= average_title_length %>">
<div class="pub-c-title pub-c-title--<%= average_title_length %>">
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this means if the long title length is not active we'll have a class of "pub-c-title pub-c-title--" which is not a big deal but seems like it could be avoided?

Copy link
Contributor

Choose a reason for hiding this comment

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

It defaults to 'average', no?

Copy link
Contributor

Choose a reason for hiding this comment

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

assert_select ".pub-c-title__context", text: "Format"
end

test "applies title length if supplied" do
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Nice

@vanitabarrett vanitabarrett force-pushed the refactor-title-component branch from 71356f9 to bbedd6a Compare August 21, 2017 10:11
@NickColley
Copy link
Contributor

Searching the codebase for any overrides I found https://github.com/alphagov/collections/blob/cbaae81eed6cf2dac1b4b7885e864d5f5d1e024d/app/views/taxons/_page_header.html.erb#L3 so we need to update collections to use the govuk-title component and then we can ship this change.

Updating static title component to meet government-frontend component conventions.
This includes:
* Using pub-c namespace for CSS classes
* Use of BEM
* Adding accessibility criteria to docs
@vanitabarrett vanitabarrett force-pushed the refactor-title-component branch from bbedd6a to 7d3f6b1 Compare August 21, 2017 10:34
@vanitabarrett
Copy link
Contributor Author

@NickColley I've had a look at Collections in more detail. It looks like there's about 4 different titles being used on different pages, all with different spacing and uses, among themselves and with our component (see screenshots below, left is current collections title, right is with static title component).

Spacing differences:
screen shot 2017-08-21 at 15 19 22

This title also contains a description, which our title component doesn't take as a parameter.
screen shot 2017-08-21 at 15 25 45

If we want to integrate the title component, we'd probably have to override some of the component CSS within collections, which doesn't feel like a good thing to be do? What are your thoughts on where to go from here?

@vanitabarrett vanitabarrett changed the title Update title component to meet chosen conventions [DO NOT MERGE] Update title component to meet chosen conventions Aug 22, 2017
@fofr
Copy link
Contributor

fofr commented Aug 23, 2017

@vanitabarrett @NickColley Should we iterate collections to not use the title component?

@vanitabarrett
Copy link
Contributor Author

@fofr @NickColley The collections title does feel different to the static title - perhaps in the future it should really be an app-specific component in itself (if other apps move over to our component pattern). For now we could remove the govuk-title so it doesn't rely on the static styling, and add the styling it needs into collections?

@NickColley
Copy link
Contributor

I've not closely looked but the title component should be broadly applicable, seems like the main problem is spacing which is something we know we need to solve.

@NickColley
Copy link
Contributor

@vanitabarrett I think we can avoid the headings that are not currently using the govuk-title classes and create a card to consolidate them separately.

I've had a look at the remaining use cases.

That text underneath the title, looks a lot like our lead paragraph component.

screen shot 2017-08-23 at 16 12 09

This means if we can move the lead paragraph component to static, and allow flexible spacing for the title component. We should be good to go?

@NickColley
Copy link
Contributor

screen shot 2017-08-23 at 16 17 54

Screenshot showing the above hacked in

@vanitabarrett
Copy link
Contributor Author

To get this story completed more quickly, we've decided to (for now) remove the use of the govuk-title class in Collections and simply copy over the styling. This has been done in alphagov/collections#373

Have added stories to the Planning board to move over lead paragraph to static and update collection titles to use static components

@fofr
Copy link
Contributor

fofr commented Aug 24, 2017

We need to deploy Collections before merging this.

We need to add the old gov-uk styling for deployment so any cached HTML is still styled correctly. Will remove after deployment.
@vanitabarrett vanitabarrett changed the title [DO NOT MERGE] Update title component to meet chosen conventions Update title component to meet chosen conventions Aug 24, 2017
@vanitabarrett vanitabarrett merged commit a0b0823 into master Aug 24, 2017
@vanitabarrett vanitabarrett deleted the refactor-title-component branch August 24, 2017 13:22
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