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

Make override classes consistently verbose #786

Merged
merged 5 commits into from
Jun 14, 2018

Conversation

NickColley
Copy link
Contributor

@NickColley NickColley commented Jun 13, 2018

In https://gist.github.com/nickcolley/f135e89ed4b679355b0ab47135b38ee8 I went over the current inconsistencies with our override classes.

The community was in favour of making these consistently verbose.

We've extended the shorthand 'f' to longhand 'font-size' and
extended the shorthand 'w' to longhand 'font-weight'

This changes the selectors from
.govuk-!-f-rN to .govuk-!-font-size-N.

We've made the decision to remove the 'r' for responsive, this was hard to remember users found this confusing. (Closes #689)

We'll consider adding a '--fixed' modifier in the future if we require a static version of this override.

Override classes prior to this change (total of 118):

.govuk-!-display-inline
.govuk-!-display-inline-block
.govuk-!-display-block
.govuk-!-m-r0
.govuk-!-mt-r0
.govuk-!-mr-r0
.govuk-!-mb-r0
.govuk-!-ml-r0
.govuk-!-m-r1
.govuk-!-mt-r1
.govuk-!-mr-r1
.govuk-!-mb-r1
.govuk-!-ml-r1
.govuk-!-m-r2
.govuk-!-mt-r2
.govuk-!-mr-r2
.govuk-!-mb-r2
.govuk-!-ml-r2
.govuk-!-m-r3
.govuk-!-mt-r3
.govuk-!-mr-r3
.govuk-!-mb-r3
.govuk-!-ml-r3
.govuk-!-m-r4
.govuk-!-mt-r4
.govuk-!-mr-r4
.govuk-!-mb-r4
.govuk-!-ml-r4
.govuk-!-m-r5
.govuk-!-mt-r5
.govuk-!-mr-r5
.govuk-!-mb-r5
.govuk-!-ml-r5
.govuk-!-m-r6
.govuk-!-mt-r6
.govuk-!-mr-r6
.govuk-!-mb-r6
.govuk-!-ml-r6
.govuk-!-m-r7
.govuk-!-mt-r7
.govuk-!-mr-r7
.govuk-!-mb-r7
.govuk-!-ml-r7
.govuk-!-m-r8
.govuk-!-mt-r8
.govuk-!-mr-r8
.govuk-!-mb-r8
.govuk-!-ml-r8
.govuk-!-m-r9
.govuk-!-mt-r9
.govuk-!-mr-r9
.govuk-!-mb-r9
.govuk-!-ml-r9
.govuk-!-p-r0
.govuk-!-pt-r0
.govuk-!-pr-r0
.govuk-!-pb-r0
.govuk-!-pl-r0
.govuk-!-p-r1
.govuk-!-pt-r1
.govuk-!-pr-r1
.govuk-!-pb-r1
.govuk-!-pl-r1
.govuk-!-p-r2
.govuk-!-pt-r2
.govuk-!-pr-r2
.govuk-!-pb-r2
.govuk-!-pl-r2
.govuk-!-p-r3
.govuk-!-pt-r3
.govuk-!-pr-r3
.govuk-!-pb-r3
.govuk-!-pl-r3
.govuk-!-p-r4
.govuk-!-pt-r4
.govuk-!-pr-r4
.govuk-!-pb-r4
.govuk-!-pl-r4
.govuk-!-p-r5
.govuk-!-pt-r5
.govuk-!-pr-r5
.govuk-!-pb-r5
.govuk-!-pl-r5
.govuk-!-p-r6
.govuk-!-pt-r6
.govuk-!-pr-r6
.govuk-!-pb-r6
.govuk-!-pl-r6
.govuk-!-p-r7
.govuk-!-pt-r7
.govuk-!-pr-r7
.govuk-!-pb-r7
.govuk-!-pl-r7
.govuk-!-p-r8
.govuk-!-pt-r8
.govuk-!-pr-r8
.govuk-!-pb-r8
.govuk-!-pl-r8
.govuk-!-p-r9
.govuk-!-pt-r9
.govuk-!-pr-r9
.govuk-!-pb-r9
.govuk-!-pl-r9
.govuk-!-f-80
.govuk-!-f-48
.govuk-!-f-36
.govuk-!-f-27
.govuk-!-f-24
.govuk-!-f-19
.govuk-!-f-16
.govuk-!-f-14
.govuk-!-w-regular
.govuk-!-w-bold
.govuk-!-width-three-quarters
.govuk-!-width-two-thirds
.govuk-!-width-one-half
.govuk-!-width-one-third
.govuk-!-width-one-quarter

Override classes after this change (total 118):

.govuk-!-display-inline
.govuk-!-display-inline-block
.govuk-!-display-block
.govuk-!-margin-0
.govuk-!-margin-top-0
.govuk-!-margin-right-0
.govuk-!-margin-bottom-0
.govuk-!-margin-left-0
.govuk-!-margin-1
.govuk-!-margin-top-1
.govuk-!-margin-right-1
.govuk-!-margin-bottom-1
.govuk-!-margin-left-1
.govuk-!-margin-2
.govuk-!-margin-top-2
.govuk-!-margin-right-2
.govuk-!-margin-bottom-2
.govuk-!-margin-left-2
.govuk-!-margin-3
.govuk-!-margin-top-3
.govuk-!-margin-right-3
.govuk-!-margin-bottom-3
.govuk-!-margin-left-3
.govuk-!-margin-4
.govuk-!-margin-top-4
.govuk-!-margin-right-4
.govuk-!-margin-bottom-4
.govuk-!-margin-left-4
.govuk-!-margin-5
.govuk-!-margin-top-5
.govuk-!-margin-right-5
.govuk-!-margin-bottom-5
.govuk-!-margin-left-5
.govuk-!-margin-6
.govuk-!-margin-top-6
.govuk-!-margin-right-6
.govuk-!-margin-bottom-6
.govuk-!-margin-left-6
.govuk-!-margin-7
.govuk-!-margin-top-7
.govuk-!-margin-right-7
.govuk-!-margin-bottom-7
.govuk-!-margin-left-7
.govuk-!-margin-8
.govuk-!-margin-top-8
.govuk-!-margin-right-8
.govuk-!-margin-bottom-8
.govuk-!-margin-left-8
.govuk-!-margin-9
.govuk-!-margin-top-9
.govuk-!-margin-right-9
.govuk-!-margin-bottom-9
.govuk-!-margin-left-9
.govuk-!-padding-0
.govuk-!-padding-top-0
.govuk-!-padding-right-0
.govuk-!-padding-bottom-0
.govuk-!-padding-left-0
.govuk-!-padding-1
.govuk-!-padding-top-1
.govuk-!-padding-right-1
.govuk-!-padding-bottom-1
.govuk-!-padding-left-1
.govuk-!-padding-2
.govuk-!-padding-top-2
.govuk-!-padding-right-2
.govuk-!-padding-bottom-2
.govuk-!-padding-left-2
.govuk-!-padding-3
.govuk-!-padding-top-3
.govuk-!-padding-right-3
.govuk-!-padding-bottom-3
.govuk-!-padding-left-3
.govuk-!-padding-4
.govuk-!-padding-top-4
.govuk-!-padding-right-4
.govuk-!-padding-bottom-4
.govuk-!-padding-left-4
.govuk-!-padding-5
.govuk-!-padding-top-5
.govuk-!-padding-right-5
.govuk-!-padding-bottom-5
.govuk-!-padding-left-5
.govuk-!-padding-6
.govuk-!-padding-top-6
.govuk-!-padding-right-6
.govuk-!-padding-bottom-6
.govuk-!-padding-left-6
.govuk-!-padding-7
.govuk-!-padding-top-7
.govuk-!-padding-right-7
.govuk-!-padding-bottom-7
.govuk-!-padding-left-7
.govuk-!-padding-8
.govuk-!-padding-top-8
.govuk-!-padding-right-8
.govuk-!-padding-bottom-8
.govuk-!-padding-left-8
.govuk-!-padding-9
.govuk-!-padding-top-9
.govuk-!-padding-right-9
.govuk-!-padding-bottom-9
.govuk-!-padding-left-9
.govuk-!-font-size-80
.govuk-!-font-size-48
.govuk-!-font-size-36
.govuk-!-font-size-27
.govuk-!-font-size-24
.govuk-!-font-size-19
.govuk-!-font-size-16
.govuk-!-font-size-14
.govuk-!-font-weight-regular
.govuk-!-font-weight-bold
.govuk-!-width-three-quarters
.govuk-!-width-two-thirds
.govuk-!-width-one-half
.govuk-!-width-one-third
.govuk-!-width-one-quarter

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 13:08 Inactive
@NickColley NickColley changed the title Make overrides consistently verbose Make override classes consistently verbose Jun 13, 2018
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 13:21 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 13:34 Inactive
CHANGELOG.md Outdated
@@ -153,6 +153,27 @@ Note: We're not following semantic versioning yet, we are going to talk about th

([PR #778](https://github.com/alphagov/govuk-frontend/pull/778))

- Make override classes consistently verbose #786
Copy link

Choose a reason for hiding this comment

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

stray pr number

@kr8n3r
Copy link

kr8n3r commented Jun 13, 2018

this needs updating

Class names within this layer use an additional prefix `-!-`, for example
`.govuk-!-w-regular`.

@kr8n3r
Copy link

kr8n3r commented Jun 13, 2018

yaml and by extension readme files in radios

items:
      - value: 'part-2'
        html:
          <span class="govuk-heading-s govuk-!-mb-r1">Part 2 of the Housing Act 2004</span>
          For properties that are 3 or more stories high and occupied by 5 or more people
      - value: 'part-3'
        html:
          <span class="govuk-heading-s govuk-!-mb-r1">Part 3 of the Housing Act 2004</span>
          For properties that are within a geographical area defined by a local council

@kr8n3r kr8n3r mentioned this pull request Jun 13, 2018
We've extended the shorthand 'f' to longhand 'font-size' and
extended the shorthand 'w' to longhand 'font-weight'

This changes the selectors from
`.govuk-!-f-rN` to `.govuk-!-font-size-N`.
@NickColley NickColley force-pushed the make-overrides-consistent branch from 861b2a2 to d9399d6 Compare June 13, 2018 16:24
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 16:24 Inactive
@NickColley NickColley force-pushed the make-overrides-consistent branch from d9399d6 to acd6638 Compare June 13, 2018 16:28
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 16:28 Inactive
@NickColley
Copy link
Contributor Author

NickColley commented Jun 13, 2018

For reviewers, I've been running the following in the review application

var stylesheet = document.styleSheets[0]
var selectors = []
var rules = stylesheet.cssRules;
for (var i = 0; i < rules.length; i++) {
  selectors.push(rules[i].selectorText);
}
selectors = 
  selectors
    .filter(selector => selector)
    .filter(selector => selector.startsWith('.govuk-\\!'))
    .map(selector => selector.trim())
console.log(selectors.join('\n'), selectors.length)

To check the before and after.

@NickColley NickColley force-pushed the make-overrides-consistent branch from acd6638 to 74052a3 Compare June 13, 2018 16:40
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 16:40 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-786 June 13, 2018 16:45 Inactive
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

I think this looks really good, all the class names seem to be make sense and I haven't been able to find any visual differences in the review app.

Just noticed one comment that needs removing.

That script is handy 👍

@@ -23,40 +23,39 @@ $_spacing-directions: (
/// indicates that. We might want to add non-responsive ones later.
Copy link
Member

Choose a reason for hiding this comment

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

The bit about "the 'r' before the scale point indicates that" just needs to come out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot thanks Hanna

We've made the decision to remove the 'r' for responsive, this was hard to remember users found this confusing.
We'll consider adding a '--fixed' modifier in the future if we require a static version of this override.
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

💯

@NickColley NickColley merged commit 859f564 into master Jun 14, 2018
@NickColley NickColley deleted the make-overrides-consistent branch June 14, 2018 09:18
@hannalaakso hannalaakso mentioned this pull request Jun 14, 2018
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.

4 participants