-
Notifications
You must be signed in to change notification settings - Fork 334
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
Opt-in global anchor and paragraph styles #658
Conversation
789ab3a
to
8ad882d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two comment. The second one is non-blocking and more of a personal opinion. Otherwise it's good to go. I'll wait for other to have a look, since it's more about agreeing on the approach.
docs/global-styles.md
Outdated
|
||
In GOV.UK Frontend we want to provide a convenient way to have correct styles applied to your links (`<a>`) and paragraphs (`<p>`) without having to set required classes for each instance of an element. | ||
|
||
We have chosen 'Opt-in' as the default behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we say 'Opted-in'. For me 'Opt-in' sound like I have the option to choose if I want it, which is the opposite of what we're doing by default. We can ask @amyhupe to help with wording.
src/all/_all.scss
Outdated
// Settings | ||
@import "../globals/common"; | ||
@import "../globals/optional/global-styles"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the context optional/
may be the right name.
My view of this was that we'd have a /core
in which we place the default style that you can choose not to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was considering putting it in core first. i have no issue with it being in core tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quite like optional/
as this clearly differentiates those styles from the rest. But not a blocker.
4f1d1c3
to
910f4d7
Compare
910f4d7
to
32a588f
Compare
docs/global-styles.md
Outdated
@import "govuk-frontend/all/all"; | ||
``` | ||
If you choose this option, you will need to either use classes on links (`<a>`) and paragraphs (`<p>`) or have a different way to apply correct styles. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to document here, or link from here to another doc, what to look out for if choosing to set $govuk-global-styles
to false
and adding our link classes selectively, eg. govuk-link
class must be added along with govuk-link--muted
.
Instead of "use classes", maybe "add GOV.UK Frontend classes"?
docs/global-styles.md
Outdated
@@ -0,0 +1,20 @@ | |||
# Global Styles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this documentation is most likely to be useful if you're using the legacy stuff, with this in mind should we align this work with the compatibility mode stuff?
User scenario:
- I have GOV.UK Template, and just want a build that works with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case you don't need global styles then, right? As they're coming from template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of the *compatibillity vars are set to true in Frontend 🤔
32a588f
to
de4bdf9
Compare
de4bdf9
to
5920d0d
Compare
5920d0d
to
8818d78
Compare
8818d78
to
39defd2
Compare
39defd2
to
9a099d1
Compare
9a099d1
to
f5955d6
Compare
f5955d6
to
c000305
Compare
src/globals/core/_global-styles.scss
Outdated
// | ||
// 4. If both $govuk-global-styles and $govuk-compatibility-govuktemplate are set to false | ||
// then don't include global styles | ||
@if global-variable-exists("govuk-global-styles") == false or $govuk-global-styles == true or $govuk-compatibility-govuktemplate == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be $govuk-compatibility-govuktemplate == false
?
(and would it need the global-variable-exists
statement too?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my understanding:
If we agree that global styles should be enabled for new projects (or prototyping) this should be the default.
Then if people need to use GOV.UK Frontend in a way that's compatible with the older projects they should opt in.
With this in mind.
All compatibility flags should be false
by default.
global styles should be true
by default
govuktemplate flag should set global styles to false
global styles should still be able to be set on it's own, if the user is using GOV.UK Frontend in a project that uses another framework for example.
so at the risk of complicating this PR, should we need to update the defaults for the compatibility flags?
It would be good to go over this - I'm finding it hard to understand the logic and naming - especially |
c000305
to
9837953
Compare
9adb06c
to
27a5744
Compare
src/all/all.test.js
Outdated
const results = await sassRender({ data: sass, ...sassConfig }) | ||
expect(results.css.toString()).toContain(', p {') | ||
}) | ||
it('for links and paragraphs are not output if flag is set to false', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also have variants for
- When compatibility flags are set to true
- When compatibility flags are set to true and global flag is set to true
it would be great to get a diagram to explain the logic for this work - happy to help out if needed |
dd5bfd3
to
c13c6ec
Compare
@dashouse made a point that if you are using template then you might need our globals as we have changed spacing in typography |
08bf080
to
e837894
Compare
updated to just include optional global styles based on a flag |
e837894
to
cf119ae
Compare
cf119ae
to
563d373
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 👍 👏
To ease prototyping and new production instances we provided a way to include global styles for links and paragraphs, so that users do not have to add classes to every paragraph or link.
Inclusion is controlled by
$govuk-global-styles
variable inglobals/settings
folder.Documentation has been added to the main README.md file
If Elements or Template compatibility variables are set to true then we render fixes to those and also include global styles
Trello: https://trello.com/c/toKpf2vV/868-3-add-optional-styles-that-set-paragraph-and-link-styles