-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add department colours to components #296
Conversation
003c6ca
to
ec40611
Compare
ec40611
to
2f4db8d
Compare
} | ||
} | ||
|
||
@include organisation-brand-colour(); |
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.
Not sure we need the ()?
I like this approach, I think it makes sense to use the logic in Happy to re-review and 👍 once you've added some documentation for the document list component using the department colours |
2f4db8d
to
0fc5a79
Compare
0fc5a79
to
aba82e4
Compare
- include all class outputs as a helper
aba82e4
to
db727b8
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.
Sorry for the late comments, I missed this PR.
brand_helper = GovukPublishingComponents::Presenters::BrandHelper.new(brand) | ||
%> | ||
|
||
<div class="gem-c-component <%= brand_helper.get_brand %>"> |
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.
We mostly avoid prefixing getters with get_
(I'm not sure why Rubocop hasn't picked that up, I'll investigate).
To me get_brand
also implies that it'll return the brand
passed in. Perhaps brand_class
would reveal the intention more?
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.
Great suggestions, thanks. See this PR -> #300
%> | ||
|
||
<div class="gem-c-component <%= brand_helper.get_brand %>"> | ||
<div class="gem-c-component__title <%= brand_helper.get_brand_element("border-color") %>"> |
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 it's worth it creating separate method for this and color
to avoid typos.
Perhaps something like:
- <%= brand_helper.get_brand_element("border-color") %>">
+ <%= brand_helper.border_color_class %>
- <%= brand_helper.get_brand_element("color") %>">
+ <%= brand_helper.color_class %>
This PR follows the discussion over this RFC to add department colour branding to components.
The main point of discussion in the RFC centred around using colour specific classes instead of department ones, to avoid duplication and make the classnames more meaningful. I have decided not to implement this for the following reasons:
colour--light-red
,colour--lighter-red
doesn't scale well if new colours are needed later, and neither doescolour--red-1
,colour--red-2
etc.I've written the code to be as flexible as possible (classes are all output from a helper method) so if a new approach is needed in future it shouldn't be too difficult to adapt. This change therefore broadly follows the originally proposed idea, with some specific changes:
In total this adds around 4KB to the CSS in the gem.
This PR includes two commits; one to add the colours and one to show how the model works on a component (note that the link to documentation in it won't work yet).
Trello card: https://trello.com/c/r4PLGbH5/58-create-a-branding-model-for-components