Skip to content

Commit

Permalink
[WEBDEV-557] Remove .list--details CSS-Class and HTML-Wrapper (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawaheed authored and UsmanAfzal committed Jun 1, 2018
1 parent 8a54ebd commit 6e5270b
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 217 deletions.
98 changes: 52 additions & 46 deletions src/elements/_lists.pug
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//- List Box
mixin list--block(name, constituency, party, image)
li
if image
.card
.card
if image
figure.avatar--round
+link('#', '')(aria-hidden="true", tabIndex="-1")
picture
Expand All @@ -15,72 +15,78 @@ mixin list--block(name, constituency, party, image)
p= 'MP for ' + constituency
p= party

else
.list--details
h2 #[+link('#', constituency)]
p= name
else
.card__details
h2 #[+link('#', constituency)]
p= name

//- List Box Parties
mixin list--block__parties(party, count)
li
.list--details
h2 #[+link('#', party)]
p= 'All current ' + party + ' MPs'
.list--details
span.count= count
| MPs
.card
.card__details
h2 #[+link('#', party)]
p= 'All current ' + party + ' MPs'
.card__details
span.count= count
| MPs

//- List Box Accessible
mixin list--block__accessible(constituency, date)
li
.list--details
if constituency
h2 #[+link('#', constituency)]
span.sr-only= 'constituency from ' + date
p
span(aria-hidden='true')= date
else
h2 #[+link('#', date)]
.card
.card__details
if constituency
h2 #[+link('#', constituency)]
span.sr-only= 'constituency from ' + date
p
span(aria-hidden='true')= date
else
h2 #[+link('#', date)]

//- List Box Generic
mixin list--block__generic(heading, content)
li
.list--details
if list_box_h4
h4 #[+link('#', heading)]
else if list_box_h3
h3 #[+link('#', heading)]
else
h2 #[+link('#', heading)]
p= content
block
.card
.card__details
if list_box_h4
h4 #[+link('#', heading)]
else if list_box_h3
h3 #[+link('#', heading)]
else
h2 #[+link('#', heading)]
p= content
block

//- List Box Inline
//- List Block Inline
mixin list--block__inline(name, count, inline_text)
if inline_text
li
.list--details__inline
h2 #[+link('#', name)]
p= '- ' + count + ' MPs'
.card--inline
.card__details
h2 #[+link('#', name)]
p= '- ' + count + ' MPs'
else
li
.list--details
h2 #[+link('#', name)]
p= count + ' MPs'
.card
.card__details
h2 #[+link('#', name)]
p= count + ' MPs'

//- List Pipe
mixin list--pipe(constituency, date, name)
li
.list--details
if member
p= 'MP for '
+link('#', constituency)
p= date
else if name
h2 #[+link('#', name)]
p= date
else
p= date
.card
.card__details
if member
p= 'MP for '
+link('#', constituency)
p= date
else if name
h2 #[+link('#', name)]
p= date
else
p= date

//- List Pipe Media
mixin list--pipe__media(imgURL, imgAlt, heading, btnURL, btnText)
Expand Down
15 changes: 6 additions & 9 deletions src/elements/_utilities.pug
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
ul.list--inline
li.visually-hidden(aria-hidden='true')
.list--details
include ../icons/print.svg
+link('#', 'Print page').btn--print
include ../icons/print.svg
+link('#', 'Print page').btn--print
li
.list--details
include ../icons/download.svg
+link('#', 'Download as PDF')
include ../icons/download.svg
+link('#', 'Download as PDF')
li
.list--details
include ../icons/share.svg
+link('#', 'Share')
include ../icons/share.svg
+link('#', 'Share')
28 changes: 22 additions & 6 deletions src/stylesheets/components/_card.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
/*--- Card ---*/

.card,
[class*="card--"] {
@include media($extra-small) {
@include card;
}
}

/*--- Card inline ---*/

.card--inline .card__details * {
display: inline;
}

/*--- Card details ---*/

.card__details {
@include first-child;
@include last-child;
@include media($extra-small) {
flex: 1 1 0;
}
> * {
margin-top: $base-spacing-unit;
margin-bottom: $base-spacing-unit;
}
@include last-child();
}

.card__details + .card__details {
@include media($extra-small) {
flex: 1 1 0;
> * {
flex-basis: 100%;
margin-bottom: $base-spacing-unit;
}
max-width: 25%;
align-self: center;
text-align: right;
}
}
19 changes: 0 additions & 19 deletions src/stylesheets/components/_list-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,25 +167,6 @@ dl, dt, dd {
list-style-type: lower-alpha;
}

/*--- List Details Options ---*/

.list--details {
@include list--details
}

.list--details__inline {
@include list--details__inline;
}

.list--details + .list--details {
@include media($extra-small) {
flex-basis: 25%;
text-align: right;
align-self: center;
margin-left: $base-spacing-unit;
}
}

/*--- Default Nested Lists [ul/ol] ---*/

// List style for <ul> tags without any classes, nested
Expand Down
15 changes: 1 addition & 14 deletions src/stylesheets/elements/_headings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ footer h2 {
}
}

.list--details, .list--details__inline {
h2, h3, h4, h5, h6 {
margin-top: 0;
}
}

/*--- List Events ---*/

.list--events > li > {
Expand Down Expand Up @@ -235,15 +229,8 @@ article + aside > h2 {
.card,
[class*="card--"] {
h2, h3, h4, h5, h6 {
@extend .epsilon;
@include epsilon;
flex-basis: 100%;
color: $grey-1;
margin: 0 0 $base-spacing-unit;

@include media($extra-small) {
~ * {
margin-top: $base-spacing-unit;
}
}
}
}
49 changes: 8 additions & 41 deletions src/stylesheets/settings/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@

/*--- Remove top/bottom margins ---*/

@mixin last-child() {
@mixin first-child {
:first-child {
margin-top: 0;
}
}

@mixin last-child {
:last-child {
margin-bottom: 0;
}
Expand Down Expand Up @@ -393,15 +399,6 @@
> li {
width: 100%;
@include block;
@include media($extra-small) {
display: inline-flex;
}
/* IE11 Fix */
@media(-ms-high-contrast: none) {
*::-ms-backdrop, figure + .list--details {
padding-left: $base-spacing-unit-small;
}
}
}
}

Expand All @@ -415,50 +412,20 @@
background: transparent;
border-bottom: solid 1px $grey-3;
padding: $base-spacing-unit-tiny 0 ($base-spacing-unit-tiny - 1) 0;
@include media($extra-small) {
display: inline-flex;
}
/* IE11 Fix */
@media(-ms-high-contrast: none) {
*::-ms-backdrop, figure + .list--details {
padding-left: $base-spacing-unit-large;
}
}
}
> li:first-of-type {
border-top: solid 1px $grey-3;
}
}

@mixin list--details {
margin-top: 0;
word-break: break-word;
@include media($extra-small) {
flex-basis: 100%;
display: inline-block;
}
* {
margin-bottom: $base-spacing-unit;
}
:last-child {
margin-bottom: 0;
}
}

@mixin list--details__inline {
@include list--details;
* {
display: inline;
}
}

/*--- Card Mixins ---*/

@mixin card {
display: flex;
flex-wrap: wrap;
flex-basis: 100%;
align-items: flex-start;
@include headings-margin-top(0);
}

/*--- Avatar Mixins ---*/
Expand Down
9 changes: 5 additions & 4 deletions src/templates/prototypes/_headings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ block content
h2 Heading preceding a heading
ul.list--block
li
.list--details
h5 MP for #[+link('#', 'Hackney North and Stoke Newington')]
p Parliamentary role
p 8 Jun 2017 to present
.card
.card__details
h5 MP for #[+link('#', 'Hackney North and Stoke Newington')]
p Parliamentary role
p 8 Jun 2017 to present
h2 Heading preceding content
p Paragraph preceding a heading
h2 Heading ending timeline
Loading

0 comments on commit 6e5270b

Please sign in to comment.