-
Notifications
You must be signed in to change notification settings - Fork 17
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
HTML Publications clean-up #394
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
.contents-list { | ||
margin-bottom: $gutter-two-thirds; | ||
|
||
// Always render the contents list above a | ||
// back to contents link | ||
position: relative; | ||
z-index: 1; | ||
background: $white; | ||
box-shadow: 0 20px 15px -10px $white; | ||
|
||
li { | ||
padding-top: $gutter / 4; | ||
line-height: 1.3; | ||
list-style-type: none; | ||
} | ||
|
||
// Remove underlines from lists of links | ||
// to improve legibility | ||
a { | ||
text-decoration: none; | ||
|
||
&:hover, | ||
&:focus, | ||
&:active { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
&.contents-list-nested, | ||
&.contents-list-dashed { | ||
li { | ||
margin-left: $gutter-half + 5; | ||
padding-right: $gutter-half + 5; | ||
list-style-type: disc; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line isn't needed - I don't believe there's any circumstances now where the list items should have a disc, it seems to always get overridden. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is used by browsers that do not support |
||
|
||
@supports (content: "—") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a browser we support that doesn't support content: "-" ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember having reason to keep the This code isn't really being changed by this PR, just moved. Might be worth assessing as a separate issue. |
||
list-style-type: none; | ||
|
||
&:before { | ||
content: "— "; | ||
position: relative; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is position relative needed on this before element? |
||
float: left; | ||
width: $gutter-half + 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is width needed? If I turn it off in the inspector it doesn't appear to make any difference, I'd expect the width to be defined by the content? |
||
margin-left: -($gutter-half + 5); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// When nesting contents lists, the top level items have no | ||
// list marker and are styled in bold | ||
&.contents-list-nested { | ||
.nested-contents-item-h2 { | ||
margin-left: 0; | ||
list-style-type: none; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this needs to be defined here - the main styles for this list already set list-style-type to none. |
||
|
||
&:before { | ||
content: ''; | ||
} | ||
} | ||
|
||
.nested-contents-link-h2 { | ||
font-weight: bold; | ||
} | ||
} | ||
|
||
&.contents-list-numbered { | ||
a { | ||
display: table; | ||
} | ||
|
||
.contents-text, | ||
.contents-number { | ||
display: table-cell; | ||
} | ||
|
||
.contents-number { | ||
min-width: 1.5em; | ||
} | ||
|
||
.contents-text { | ||
$contents-text-padding: 0.3em; | ||
padding-left: $contents-text-padding; | ||
|
||
.direction-rtl & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this been tested with proper RTL content? I don't have an example page so all I can do is apply the class to an English page, but if I do that the dashes in the contents list remain on the left hand side. Might be worth checking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same code as was tested successfully in #395, just moved to a new file. |
||
padding-left: 0; | ||
padding-right: $contents-text-padding; | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,13 @@ | |
@include core-19; | ||
color: $white; | ||
background: $light-blue; | ||
padding: $gutter; | ||
padding: ($gutter * 2) $gutter $gutter; | ||
margin-bottom: $gutter * 2; | ||
} | ||
|
||
// Based on the govuk-title component | ||
.html-publication-title { | ||
margin-bottom: $gutter; | ||
margin-bottom: $gutter / 2; | ||
|
||
.context { | ||
@include core-27; | ||
|
@@ -51,71 +51,23 @@ | |
} | ||
} | ||
|
||
.contents-list-wrapper { | ||
.column-quarter-desktop-only { | ||
@include grid-column( 1 / 4, $full-width: desktop ); | ||
|
||
.direction-rtl & { | ||
float: right; | ||
direction: rtl; | ||
text-align: start; | ||
} | ||
|
||
.contents-list { | ||
position: relative; | ||
z-index: 1; | ||
padding-bottom: $gutter; | ||
list-style: none; | ||
background: $white; | ||
box-shadow: 0 20px 15px -10px $white; | ||
|
||
li { | ||
padding-top: $gutter / 4; | ||
line-height: 1.3; | ||
} | ||
|
||
.contents-text, | ||
.contents-number { | ||
display: table-cell; | ||
} | ||
|
||
.contents-number { | ||
min-width: 1.5em; | ||
} | ||
|
||
.contents-text { | ||
$contents-text-padding: 0.3em; | ||
padding-left: $contents-text-padding; | ||
|
||
.direction-rtl & { | ||
padding-left: 0; | ||
padding-right: $contents-text-padding; | ||
} | ||
} | ||
|
||
a { | ||
display: table; | ||
text-decoration: none; | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
@include media(false, $desktop-breakpoint) { | ||
box-shadow: none; | ||
} | ||
} | ||
} | ||
|
||
.contents-wrapper { | ||
.column-three-quarters-desktop-only { | ||
@include grid-column( 3 / 4, $full-width: desktop ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks to be collapsing to a single column at 640px, which I think is lower than HTML publications. It gets pretty compressed (particularly the contents list) just above that (in two column layout). Did you consider collapsing earlier? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be the same as before (ie as added in #384), classes are just renamed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't, I'm just assessing it as it is. |
||
|
||
.direction-rtl & { | ||
float: right; | ||
} | ||
} | ||
|
||
.offset-one-quarter { | ||
.offset-quarter-desktop-only { | ||
margin-left: 25%; | ||
|
||
.direction-rtl & { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,8 +107,8 @@ def test_meta(component) | |
test "renders a nested contents list" do | ||
setup_and_visit_content_item('aaib-reports') | ||
|
||
assert page.has_css?(".dash-list") | ||
within ".dash-list" do | ||
assert page.has_css?(".contents-list.contents-list-nested") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this line necessary? Presumably test will fail anyway if not present, and this line isn't repeated at line 121 where another test does exactly the same thing. I guess the test might fail in a different way if the line is simply omitted, but if that's the case then it should also occur before line 121 as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quite possibly, however this is a find/replace exercise to keep tests passing, rather than an assessment of every contents list test and its purpose. |
||
within ".contents-list.contents-list-nested" do | ||
@content_item['details']['headers'].each do |heading| | ||
assert_nested_content_item(heading) | ||
end | ||
|
@@ -118,7 +118,7 @@ def test_meta(component) | |
test "renders a nested contents list with level 2 and 3 headings only" do | ||
setup_and_visit_content_item('drug-device-alerts') | ||
|
||
within ".dash-list" do | ||
within ".contents-list.contents-list-nested" do | ||
@content_item['details']['headers'].each do |heading| | ||
assert_nested_content_item(heading) | ||
end | ||
|
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.
Genuine question - should there be a unit of measurement for the line height or will all browsers safely default to em? (which is what I presume it's supposed to 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.
https://css-tricks.com/almanac/properties/l/line-height/#article-header-id-0
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.
Ah, excellent.