Skip to content

Commit

Permalink
🔨 reorganise and group helper classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmartineau committed May 16, 2017
1 parent f71b23a commit 5b65518
Showing 1 changed file with 65 additions and 29 deletions.
94 changes: 65 additions & 29 deletions assets/src/scss/_helper-classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,40 @@
* Helper classes
* =================================
* Non-semantic helper classes
* - Clearfix
* - State helpers
* - Layout helpers
* - Margin helpers
* - Typography helpers
* - Misc helpers
*/

/**
* Clearfix
* http://www.cssmojo.com/latest_new_clearfix_so_far/
* See mixins/_utility.scss for a mixin version of this
* @kickoff/utils also includes a mixin version of this
*/
.clearfix::after {
content: "";
display: table;
clear: both;
}


// For background image replacement
.ir {
background-color: transparent;
background-repeat: no-repeat;
border: 0;
direction: ltr;
display: block;
overflow: hidden;
text-align: left;
text-indent: -999em;

br {
display: none;
}
}

/**
* State helpers
*/

// Hide from both screenreaders and browsers: h5bp.com/u
.is-hidden {
display: none !important;
visibility: hidden !important;
}

.is-shown { display: block; }
.is-shown { display: block !important; }
.is-visible { visibility: visible !important; }

// Hide visually and from screenreaders, but maintain layout
.is-invisible { visibility: hidden !important; }

// Hide only visually, but have it available for screenreaders: h5bp.com/v
.is-visuallyHidden {
Expand All @@ -64,30 +60,70 @@
}
}

// Hide visually and from screenreaders, but maintain layout
.is-invisible { visibility: hidden; }

.l-floatLeft {
float: left;
}

.l-floatRight {
float: right;
}
/**
* Layout helpers
*/
.l-floatLeft { float: left; }
.l-floatRight { float: right; }

.l-clear {
clear: both;
float: none;
}

/**
* Margin helpers
*/
.l-mb0 { margin-bottom: 0 !important; }
.l-mb1 { margin-bottom: $baseline !important; }
.l-mb2 { margin-bottom: ko-multiply($baseline, 2) !important; }
.l-mb3 { margin-bottom: ko-multiply($baseline, 3) !important; }

.l-mt0 { margin-top: 0 !important; }
.l-mb1 { margin-top: $baseline !important; }
.l-mb2 { margin-top: ko-multiply($baseline, 2) !important; }
.l-mb3 { margin-top: ko-multiply($baseline, 3) !important; }

/**
* Typography helpers
*/
.text-centre,

This comment has been minimized.

Copy link
@ashleynolan

ashleynolan May 17, 2017

Contributor

Would naturally think these fit under utility classes. So u-textCenter makes more sense to me to keep with the current naming scheme (or u-text-center).

This comment has been minimized.

Copy link
@mrmartineau

mrmartineau May 17, 2017

Author Member

agreed, happy to make the change

This comment has been minimized.

Copy link
@jpdriver

jpdriver May 17, 2017

would you guys ever consider providing code mods for projects that want to keep up to date with changes like text-center --> u-textCenter ?

This comment has been minimized.

Copy link
@mrmartineau

mrmartineau May 17, 2017

Author Member

@jpdriver potentially, but it is unlikely that we will get the time. Changes like these will mean that we push to a new major version of the framework, therefore API changes are assumed.

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-uppercase { text-transform: uppercase; }
.text-lowercase { text-transform: lowercase; }

// https://justmarkup.com/log/2015/07/dealing-with-long-words-in-css/
.text-hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}

/**
* Misc helpers
*/
* {
-webkit-tap-highlight-color: transparent !important;
}

// For background image replacement
.ir {
background-color: transparent;
background-repeat: no-repeat;
border: 0;
direction: ltr;
display: block;
overflow: hidden;
text-align: left;
text-indent: -999em;

br {
display: none;
}
}

/* A hack for HTML5 contenteditable attribute on mobile */
textarea[contenteditable] {
-webkit-appearance: none;
Expand Down

0 comments on commit 5b65518

Please sign in to comment.