Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lvl99/13aa612acf3d90d9372a8ba8549ad19f to your computer and use it in GitHub Desktop.
Save lvl99/13aa612acf3d90d9372a8ba8549ad19f to your computer and use it in GitHub Desktop.
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Class mixin which contain style definitions for `show` state
.-toggleable-class-show(@rules: {}) {
display: @-toggleable-display;
@rules();
}
// Class mixin which contains style definitions for `hide` state
.-toggleable-class-hide(@rules: {}) {
display: none;
@rules();
}
// State mixin to import and assign the `show` class definition
// to the component’s `show` state
.-toggleable-state-show(@rules: {}) {
&@{-toggleable-ns-class-show} {
.-toggleable-class-show(@rules);
}
}
// State mixin to import and assign the `hide` class definition
// to the component’s `hide` state
.-toggleable-state-hide(@rules: {}) {
&@{-toggleable-ns-class-hide} {
.-toggleable-class-hide(@rules);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment