-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #420 from alphagov/contents-list-components
Create contents list component
- Loading branch information
Showing
38 changed files
with
416 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@import "helpers/contents-list-helper"; | ||
|
||
.app-c-contents-list { | ||
// Always render the contents list above a | ||
// back to contents link | ||
position: relative; | ||
margin-bottom: $gutter-two-thirds; | ||
z-index: 1; | ||
background: $white; | ||
box-shadow: 0 20px 15px -10px $white; | ||
} | ||
|
||
// Remove underlines from lists of links | ||
// to improve legibility | ||
.app-c-contents-list__link { | ||
text-decoration: none; | ||
|
||
&:hover, | ||
&:focus, | ||
&:active { | ||
text-decoration: underline; | ||
} | ||
|
||
.app-c-contents-list__list-item--parent > & { | ||
font-weight: bold; | ||
} | ||
} | ||
|
||
.app-c-contents-list__list-item { | ||
padding-top: $gutter / 4; | ||
line-height: 1.3; | ||
list-style-type: none; | ||
} | ||
|
||
.app-c-contents-list__list-item--dashed { | ||
$contents-spacing: $gutter-half + 5; | ||
margin-left: $contents-spacing; | ||
padding-right: $contents-spacing; | ||
|
||
&:before { | ||
content: "— "; | ||
margin-left: -$contents-spacing; | ||
} | ||
|
||
// Focus styles on IE8 and older include the | ||
// left margin, creating an odd white box with | ||
// orange border around the em dash. | ||
// Use inline-block and vertical alignment to | ||
// fix focus styles | ||
// | ||
// https://github.com/alphagov/government-frontend/pull/420#issuecomment-320632386 | ||
.lte-ie8 & .app-c-contents-list__link { | ||
display: inline-block; | ||
vertical-align: top; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/assets/stylesheets/components/helpers/_contents-list-helper.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Contents list helper is used in both print and screen stylesheets | ||
.app-c-contents-list__list-item--numbered { | ||
.app-c-contents-list__link { | ||
display: table; | ||
} | ||
} | ||
|
||
.app-c-contents-list__number, | ||
.app-c-contents-list__numbered-text { | ||
display: table-cell; | ||
} | ||
|
||
.app-c-contents-list__number { | ||
min-width: 1.5em; | ||
} | ||
|
||
.app-c-contents-list__numbered-text { | ||
$contents-text-padding: 0.3em; | ||
padding-left: $contents-text-padding; | ||
|
||
.direction-rtl & { | ||
padding-left: 0; | ||
padding-right: $contents-text-padding; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/assets/stylesheets/components/print/_contents-list.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@import "../helpers/contents-list-helper"; | ||
|
||
// Override default browser indentation | ||
.app-c-contents-list__list, | ||
.app-c-contents-list__nested-list { | ||
padding-left: 0; | ||
margin-left: 0; | ||
} | ||
|
||
// Put indentation back where we use list style types | ||
.app-c-contents-list__list-item--dashed { | ||
margin-left: $gutter / 2; | ||
list-style-type: disc; | ||
} | ||
|
||
.app-c-contents-list__list-item--numbered, | ||
.app-c-contents-list__list-item--parent { | ||
list-style-type: none; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// PRINT STYLESHEET COMPILER | ||
// govuk_frontend_toolkit imports | ||
@import 'measurements'; | ||
|
||
@import "print/html-publication"; | ||
@import 'components/print/*'; | ||
@import 'print/html-publication'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.