Skip to content

Commit 5b65518

Browse files
committed
🔨 reorganise and group helper classes
1 parent f71b23a commit 5b65518

1 file changed

Lines changed: 65 additions & 29 deletions

File tree

assets/src/scss/_helper-classes.scss

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,40 @@
22
* Helper classes
33
* =================================
44
* Non-semantic helper classes
5+
* - Clearfix
6+
* - State helpers
7+
* - Layout helpers
8+
* - Margin helpers
9+
* - Typography helpers
10+
* - Misc helpers
511
*/
612

713
/**
814
* Clearfix
915
* http://www.cssmojo.com/latest_new_clearfix_so_far/
10-
* See mixins/_utility.scss for a mixin version of this
16+
* @kickoff/utils also includes a mixin version of this
1117
*/
1218
.clearfix::after {
1319
content: "";
1420
display: table;
1521
clear: both;
1622
}
1723

18-
19-
// For background image replacement
20-
.ir {
21-
background-color: transparent;
22-
background-repeat: no-repeat;
23-
border: 0;
24-
direction: ltr;
25-
display: block;
26-
overflow: hidden;
27-
text-align: left;
28-
text-indent: -999em;
29-
30-
br {
31-
display: none;
32-
}
33-
}
34-
24+
/**
25+
* State helpers
26+
*/
3527

3628
// Hide from both screenreaders and browsers: h5bp.com/u
3729
.is-hidden {
3830
display: none !important;
3931
visibility: hidden !important;
4032
}
4133

42-
.is-shown { display: block; }
34+
.is-shown { display: block !important; }
35+
.is-visible { visibility: visible !important; }
36+
37+
// Hide visually and from screenreaders, but maintain layout
38+
.is-invisible { visibility: hidden !important; }
4339

4440
// Hide only visually, but have it available for screenreaders: h5bp.com/v
4541
.is-visuallyHidden {
@@ -64,30 +60,70 @@
6460
}
6561
}
6662

67-
// Hide visually and from screenreaders, but maintain layout
68-
.is-invisible { visibility: hidden; }
69-
70-
.l-floatLeft {
71-
float: left;
72-
}
73-
74-
.l-floatRight {
75-
float: right;
76-
}
63+
/**
64+
* Layout helpers
65+
*/
66+
.l-floatLeft { float: left; }
67+
.l-floatRight { float: right; }
7768

7869
.l-clear {
7970
clear: both;
8071
float: none;
8172
}
8273

74+
/**
75+
* Margin helpers
76+
*/
8377
.l-mb0 { margin-bottom: 0 !important; }
78+
.l-mb1 { margin-bottom: $baseline !important; }
79+
.l-mb2 { margin-bottom: ko-multiply($baseline, 2) !important; }
80+
.l-mb3 { margin-bottom: ko-multiply($baseline, 3) !important; }
81+
8482
.l-mt0 { margin-top: 0 !important; }
83+
.l-mb1 { margin-top: $baseline !important; }
84+
.l-mb2 { margin-top: ko-multiply($baseline, 2) !important; }
85+
.l-mb3 { margin-top: ko-multiply($baseline, 3) !important; }
8586

87+
/**
88+
* Typography helpers
89+
*/
90+
.text-centre,
91+
.text-center { text-align: center; }
92+
.text-left { text-align: left; }
93+
.text-right { text-align: right; }
94+
.text-uppercase { text-transform: uppercase; }
95+
.text-lowercase { text-transform: lowercase; }
96+
97+
// https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/
98+
.text-hyphenate {
99+
overflow-wrap: break-word;
100+
word-wrap: break-word;
101+
hyphens: auto;
102+
}
86103

104+
/**
105+
* Misc helpers
106+
*/
87107
* {
88108
-webkit-tap-highlight-color: transparent !important;
89109
}
90110

111+
// For background image replacement
112+
.ir {
113+
background-color: transparent;
114+
background-repeat: no-repeat;
115+
border: 0;
116+
direction: ltr;
117+
display: block;
118+
overflow: hidden;
119+
text-align: left;
120+
text-indent: -999em;
121+
122+
br {
123+
display: none;
124+
}
125+
}
126+
91127
/* A hack for HTML5 contenteditable attribute on mobile */
92128
textarea[contenteditable] {
93129
-webkit-appearance: none;

0 commit comments

Comments
 (0)