-
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
Taxonomy List Component #476
Conversation
77be237
to
d6074d0
Compare
d6074d0
to
731a299
Compare
731a299
to
6117f73
Compare
6117f73
to
0b4254b
Compare
0b4254b
to
aea6df4
Compare
aea6df4
to
a11ee4e
Compare
a11ee4e
to
44f3545
Compare
44f3545
to
43b5488
Compare
43b5488
to
82cceac
Compare
82cceac
to
807b476
Compare
807b476
to
4f5b2c6
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.
No real problems, but as an outsider I think I have a hard time understanding this. Seems well written though.
Gemfile.lock
Outdated
@@ -1,7 +1,7 @@ | |||
PATH | |||
remote: . | |||
specs: | |||
govuk_publishing_components (9.12.0) | |||
govuk_publishing_components (9.12.1) |
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.
Presumably this version bump is required for the changes you're making? Otherwise should it be in a separate PR?
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.
This is so the PR herokuapp built - whoever last versioned the gem didn't bundle
and commit the change to the Gemfile.lock so it was failing to build.
@include media(tablet) { | ||
@include box-sizing(border-box); | ||
width: 33%; | ||
display: inline-block; |
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 inline-block is needed here?
@@ -8,9 +10,11 @@ | |||
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand) | |||
%> | |||
<% if items.any? %> | |||
<ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %> <%= brand_helper.brand_class %>"> | |||
<% unless within_multitype_list %> | |||
<ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %> <%= brand_helper.brand_class %>"> |
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.
Will this change mean that branding can't be applied to a document list inside a taxonomy list? (I don't know if that would be a problem or not)
@@ -45,5 +49,7 @@ | |||
<% end %> | |||
</li> | |||
<% end %> | |||
</ol> | |||
<% unless within_multitype_list %> |
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.
This isn't hugely untidy, so this suggestion may be overkill, but have you considered passing this chunk into content_tag
to output or not output this ol
?
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'm not sure how this would work, can you please give an example? 🙂
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 was thinking you'd wrap up the code in a block somehow and then do an if statement of some kind of either just output the block or do content_tag('ol', block)
. Thinking about this in more detail it's probably not appropriate for this situation, as you either want the wrapping ol or you don't - this would work better where you would want a choice of wrapping elements.
<% if highlight_box || document_list || image_cards %> | ||
<ul class="gem-c-taxonomy-list" data-module="track-click"> | ||
<% if image_cards %> | ||
<% image_cards[:items].in_groups_of(3, false) do |image_group| %> |
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.
Just seeking clarification here - why is this using in_groups_of(3
? I can't figure it out.
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.
Good spot, this was just left over from when I copied this code over from org pages - it's not needed any more 👍
heading_text: image_card[:link][:text], | ||
image_src: image_card[:image][:url], | ||
image_alt: image_card[:image][:alt], | ||
heading_level: image_card[:link][:heading_level], |
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.
Presumably it's not possible to pass through the parameters cleanly like for highlight_boxes and document_list? Is there anything we could change in the image card component to make that possible?
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.
As this was just a spike, I didn't look too closely into it - but I'll definitely take a look now 🙂
@@ -0,0 +1,85 @@ | |||
name: Taxonomy List | |||
description: Wraps the highlight box and document list component in one list. This is commonly used on topic pages for links to tagged content. |
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 also mention the image card here?
<% image_cards[:items].in_groups_of(3, false) do |image_group| %> | ||
<% image_group.each do |image_card| %> | ||
<li class="gem-c-taxonomy-list__item"> | ||
<%= render "govuk_publishing_components/components/image_card", { |
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.
Putting highlight boxes and document lists together works and makes sense, particularly when tested using Voiceover, but I'm not sure I'm convinced of the need to be able to do the same with image cards and document lists. What's the thinking behind this?
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.
The same as for highlight boxes and document lists - we need both to be the same list for screenreaders. See the "News and Communications" section on /student-finance
text: High needs funding | ||
path: /high-needs-funding | ||
metadata: | ||
document_type: Guide |
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 there be an example of all three together? Also if we wanted to combine one image card, one highlight box, and a document list, what would it look like - would they all stack?
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.
Hmm, this doesn't render perfectly at the moment (the highlight boxes end up on the same line as the image cards). I've had a look into this today but it's proving tricky to fix. As we don't need this yet, I'm going to create a separate card so it doesn't block this PR.
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.
Have you tried applying a class to the last element of each component type to provide (whatever is the flex equivalent of) clearing? Although I've had a quick look and can't see what that might be...
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.
@andysellick Yeah, there doesn't seem to be an easy flex equivalent, annoyingly. I got a partial solution, but it then got confusing with different numbers of image cards and on mobile
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.
Fair enough. Maybe add a note to the documentation body to point this out until we can get a fix.
4f5b2c6
to
acc3ec8
Compare
acc3ec8
to
730d492
Compare
a91cf1b
to
31dae0c
Compare
31dae0c
to
6fd66b5
Compare
6fd66b5
to
ea9c93c
Compare
ea9c93c
to
3cbd918
Compare
@andysellick I think I've addressed all your comments / made changes - can you please re-review? |
3cbd918
to
fa2d751
Compare
fa2d751
to
e345ea1
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.
Just some small stuff.
body: | | ||
The [highlight box](/component-guide/highlight_boxes), [document list](/component-guide/document_list) and [image card](/component-guide/image_card) components are standalone components. | ||
|
||
However, there are some use cases where we want to use both components to render one list of links. This is not possible when using the two components separately. |
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.
Reword 'both'.
inverse_class = "gem-c-highlight-boxes--inverse" if inverse | ||
highlight_boxes_helper = GovukPublishingComponents::Presenters::HighlightBoxesHelper.new(local_assigns) | ||
%> | ||
<% if items.any? %> | ||
<ol class="gem-c-highlight-boxes" <%= "data-module=track-click" if highlight_boxes_helper.data_tracking? %>> | ||
<% unless within_multitype_list %> | ||
<ol class="gem-c-highlight-boxes" <%= "data-module=track-click" if highlight_boxes_helper.data_tracking? %>> |
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.
This isn't really part of this PR, but is there a way of writing this line that github will like?
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 haven't been able to find much info on this - I tried a few things but nothing seemed to fix it.
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.
Fair enough. I'll take a look at the rest shortly.
@@ -64,3 +64,7 @@ | |||
.gem-c-document-list--top-margin { | |||
margin-top: $gutter-two-thirds; | |||
} | |||
|
|||
.gem-c-document-list__multi-list { | |||
width: 100%; |
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.
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.
Good spot, I thought it didn't look quite right! 👍
path: /high-needs-funding | ||
metadata: | ||
document_type: Guide | ||
public_updated_at: 2016-06-27 10:29:44 |
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.
Just for testing the layout I'd suggest adding another two link
entries in here - so the displayed example has four highlight boxes.
text: High needs funding | ||
path: /high-needs-funding | ||
metadata: | ||
document_type: Guide |
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.
Fair enough. Maybe add a note to the documentation body to point this out until we can get a fix.
e345ea1
to
2c6bdc1
Compare
2c6bdc1
to
0bbe2e1
Compare
64becca
to
0bbe2e1
Compare
Wraps the highlight box and document list component in one list. This is commonly used on topic pages for taxonomy-related navigation.
Moves the branding class to the document list item instead of the ul which may not always be rendered.
0bbe2e1
to
6644611
Compare
@andysellick Thanks for your review - I've made all the fixes (apart from the Github error highlighting around |
Trello: https://trello.com/c/PFbuMOGm/100-spike-adapt-highlight-box-component-to-work-in-a-list-of-links
We needed to work out a way to display service links (some of which are a list of highlight boxes, some are a document list) so that they are part of one HTML list. I also tried:
<ul>
from the highlight box and document list components. However, this would require developers to a) wrap the components they're using in a list tag, and b) require them to copy over styling so the elements were displayed appropriately.Link to the component: https://govuk-publishing-compon-pr-476.herokuapp.com/component-guide/taxonomy_list
I think we'd also be able to use this for image cards + document list