Skip to content

Commit

Permalink
feat!: Stopped design system CSS leaking on to other websites
Browse files Browse the repository at this point in the history
  • Loading branch information
gldgrnt committed Jul 29, 2021
1 parent 0036fdc commit 7e32b7b
Show file tree
Hide file tree
Showing 92 changed files with 65,691 additions and 38,542 deletions.
2 changes: 1 addition & 1 deletion .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ rules:
no-qualifying-elements:
- 2
- allow-element-with-attribute: true
allow-element-with-class: false
allow-element-with-class: true
allow-element-with-id: false

# TODO: no-trailing-whitespace
Expand Down
103,171 changes: 65,130 additions & 38,041 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"findandreplacedomtext": "^0.4.6",
"gulp-sass": "^4.1.0",
"iframe-resizer": "^4.3.1",
"path": "^0.12.7"
"path": "^0.12.7",
"tfwm-travel-updates-widget": "^1.0.0"
}
}
70 changes: 41 additions & 29 deletions src/wmnds/assets/sass/styles/_general.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@
.wmnds-html {
min-width: 320px;
margin: 0;
padding: 0;
overflow-y: auto;
color: get-color(text);
background: get-color(background);
font-family: $x-font-family;
@include type-setting(0);
scroll-behavior: smooth;
}

* {
box-sizing: border-box;
body {
margin: 0;
padding: 0;
color: get-color(text);
font-family: $x-font-family;
@include type-setting(0);
}
}

li {
margin-bottom: $size-xsm;
}
[class*="wmnds-"] {
box-sizing: border-box;
color: get-color(text);
font-family: $x-font-family;
@include type-setting(0);

// Images
img {
max-width: 100%;
height: auto;
}
// Images
img {
max-width: 100%;
height: auto;
}

// Text highlighting color
::-moz-selection {
// Code for Firefox
color: $white;
background: get-color(primary);
}
// Text highlighting color
::-moz-selection {
// Code for Firefox
color: $white;
background: get-color(primary);
}

::selection {
color: $white;
background: get-color(primary);
}
::selection {
color: $white;
background: get-color(primary);
}

// Controls how elements look when focused (helps with accesibility/keyboard-only users)
*:focus {
outline: none;
box-shadow: 0 0 0 2px $white, 0 0 0 4px get-color(secondary);
}
// Controls how elements look when focused (helps with accesibility/keyboard-only users)
*:focus {
outline: none;
box-shadow: 0 0 0 2px $white, 0 0 0 4px get-color(secondary);
}

// This gets rid of firefox default focus dash-border
*::-moz-focus-inner {
border: 0;
// This gets rid of firefox default focus dash-border
*::-moz-focus-inner {
border: 0;
}
}
14 changes: 8 additions & 6 deletions src/wmnds/assets/sass/styles/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Included the ol tag too incase dev forgets to add .wmnds-ordered-list class.
// The ol:not([class*="wmnds-"]) line makes sure we don't target any wmnds components that are using the a tag such as the breadcrumbs

.wmnds-ordered-list,
.wmnds-html ol:not([class*="wmnds-"]) {
[class*="wmnds-"].wmnds-ordered-list,
[class*="wmnds-"] ol:not([class*="wmnds-"]) {
position: relative;
counter-reset: item;
padding-inline-start: $size-lg;
Expand All @@ -28,7 +28,8 @@
line-height: 1.5rem;
}

& > li {
& > li,
ol > li {
display: block;
position: relative;
margin-bottom: $size-xsm;
Expand Down Expand Up @@ -58,8 +59,8 @@
// Included the ol tag too incase dev forgets to add .wmnds-unordered-list class.
// The ul:not([class*="wmnds-"]) line makes sure we don't target any wmnds components that are using the a tag such as the breadcrumbs

.wmnds-unordered-list,
.wmnds-html ul:not([class*="wmnds-"]) {
[class*="wmnds-"].wmnds-unordered-list,
[class*="wmnds-"] ul:not([class*="wmnds-"]) {
list-style: none;
padding-inline-start: $size-lg;

Expand All @@ -83,7 +84,8 @@
@include type-setting(0);
}

& > li {
& > li,
ul > li {
position: relative;
margin-bottom: $size-xsm;

Expand Down
5 changes: 3 additions & 2 deletions src/wmnds/assets/sass/styles/_styles.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Global styles
@import "utilities";
@import "typography";

@import "general";
@import "typography";
@import "lists";

@import "utilities";
// Grid
@import "wmnds-grid/wmnds-grid";
219 changes: 102 additions & 117 deletions src/wmnds/assets/sass/styles/_typography.scss
Original file line number Diff line number Diff line change
@@ -1,140 +1,125 @@
html,
body {
margin: 0;
padding: 0;
color: get-color(text);
font-family: $x-font-family;
@include type-setting(0);
}

// Get rid of margin for the first header item in main content
* {
h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child {
margin-top: 0;
[class*="wmnds-"] {
div,
span,
p,
a {
@include type-setting(0);
}
}

.wmnds-grid h1[class*="wmnds-col"],
.wmnds-grid .h1[class*="wmnds-col"],
h1,
.h1,
.wmnds-grid h2[class*="wmnds-col"],
.wmnds-grid .h2[class*="wmnds-col"],
h2,
.h2,
.wmnds-grid h3[class*="wmnds-col"],
.wmnds-grid .h3[class*="wmnds-col"],
h3,
.h3,
.wmnds-grid h4[class*="wmnds-col"],
.wmnds-grid .h4[class*="wmnds-col"],
h4,
.h4 {
font-family: $x-heading-font-family;
}
p,
pre,
table,
blockquote {
margin-top: 0;
margin-bottom: $base-line-height;
}

div,
span,
li,
ul,
ol,
p,
a {
@include type-setting(0);
}
// Let's make sure all's aligned
sub,
sup {
position: relative;
line-height: 0;
vertical-align: baseline;
}

h1,
.h1 {
color: get-color(primary);
@include type-setting(1, 0.85);
// On desktop devices
@media all and (min-width: $breakpoint-md) {
@include type-setting(1);
sup {
top: -0.5em;
}
}

h2,
.h2 {
color: get-color(primary);
@include type-setting(2, 0.85);
font-weight: bold;
// On desktop devices
@media all and (min-width: $breakpoint-md) {
@include type-setting(2);
sub {
bottom: -0.25em;
}
}

h3,
.h3 {
color: inherit;
@include type-setting(3);
font-weight: bold;
}
// Set heading font for heading elements
h1,
h1[class*="wmnds-col"],
h2,
h2[class*="wmnds-col"],
h3,
h3[class*="wmnds-col"],
h4,
h4[class*="wmnds-col"] {
font-family: $x-heading-font-family;
}

h4,
.h4 {
color: inherit;
@include type-setting(4);
font-weight: bold;
h1,
&.wmnds-h1 {
color: get-color(primary);
@include type-setting(1, 0.85);
// On desktop devices
@media all and (min-width: $breakpoint-md) {
@include type-setting(1);
}
}

&.wmnds-weight-400 {
font-weight: normal;
h2,
&.wmnds-h2 {
color: get-color(primary);
@include type-setting(2, 0.85);
font-weight: bold;
// On desktop devices
@media all and (min-width: $breakpoint-md) {
@include type-setting(2);
}
}
}

h5,
.h5 {
@include type-setting(5);
font-weight: bold;
}
h3,
&.wmnds-h3 {
color: inherit;
@include type-setting(3);
font-weight: bold;
}

h6,
.h6 {
@include type-setting(5);
font-weight: normal;
}
h4,
&.wmnds-h4 {
color: inherit;
@include type-setting(4);
font-weight: bold;

.h2 > *,
.h3 > *,
.h4 > *,
.h5 > * {
color: initial;
font-weight: initial;
}
&.wmnds-weight-400 {
font-weight: normal;
}
}

p,
ul,
ol,
pre,
table,
blockquote {
margin-top: 0;
margin-bottom: $base-line-height;
}
h5,
&.wmnds-h5 {
@include type-setting(5);
font-weight: bold;
}

ul ul,
ol ol,
ul ol,
ol ul {
margin-top: 0;
margin-bottom: 0;
}
h6,
&.wmnds-h6 {
@include type-setting(5);
font-weight: normal;
}

// Let's make sure all's aligned
sub,
sup {
position: relative;
line-height: 0;
vertical-align: baseline;
&.wmnds-h2 > *,
&.wmnds-h3 > *,
&.wmnds-h4 > *,
&.wmnds-h5 > * {
color: initial;
font-weight: initial;
}
}

sup {
top: -0.5em;
// Set heading font for heading elements
.wmnds-h1[class*="wmnds-"],
.wmnds-h2[class*="wmnds-"],
.wmnds-h3[class*="wmnds-"],
.wmnds-h4[class*="wmnds-"] {
font-family: $x-heading-font-family;
}

sub {
bottom: -0.25em;
* {
h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h1:first-child[class*="wmnds-"],
h2:first-child[class*="wmnds-"],
h3:first-child[class*="wmnds-"],
h4:first-child[class*="wmnds-"] {
margin-top: 0;
}
}
Loading

0 comments on commit 7e32b7b

Please sign in to comment.