Browse Source

Merge pull request #516 from communitiesuk/a11y-document-list

Improved semantics for document list
pull/527/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
d75f2e7f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      app/components/document_list_component.html.erb
  2. 4
      app/frontend/styles/_card.scss
  3. 7
      app/frontend/styles/_document-list.scss

16
app/components/document_list_component.html.erb

@ -1,15 +1,15 @@
<ul class="app-document-list"> <dl class="app-document-list">
<% items.each do |item| %> <% items.each do |item| %>
<li class="app-document-list__item"> <div class="app-document-list__item">
<h3 class="app-document-list__item-title"> <dt class="app-document-list__item-title">
<%= govuk_link_to item[:name], item[:href] %> <%= govuk_link_to item[:name], item[:href] %>
</h3> </dt>
<% if item[:description] %> <% if item[:description] %>
<p class="app-document-list__item-description"><%= item[:description] %></p> <dd class="app-document-list__item-description"><%= item[:description] %></dd>
<% end %> <% end %>
<% if item[:metadata] %> <% if item[:metadata] %>
<p class="app-document-list__item-metadata"><%= item[:metadata] %></p> <dd class="app-document-list__item-metadata"><%= item[:metadata] %></dd>
<% end %> <% end %>
</li> </div>
<% end %> <% end %>
</ul> </dl>

4
app/frontend/styles/_card.scss

@ -4,4 +4,8 @@
background-color: govuk-colour("light-grey"); background-color: govuk-colour("light-grey");
display: block; display: block;
position: relative; position: relative;
> *:last-child {
margin-bottom: 0;
}
} }

7
app/frontend/styles/_document-list.scss

@ -1,15 +1,8 @@
.app-document-list {
list-style: none;
padding: 0;
}
.app-document-list__item { .app-document-list__item {
margin-bottom: govuk-spacing(4); margin-bottom: govuk-spacing(4);
&:last-child { &:last-child {
border-bottom: 0;
margin-bottom: 0; margin-bottom: 0;
padding-bottom: 0;
} }
} }

Loading…
Cancel
Save