Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Commit

Permalink
Adding separator automation #198
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Redfern committed Mar 7, 2017
1 parent 3287c76 commit d57d895
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 36 deletions.
13 changes: 13 additions & 0 deletions src/scss/_setting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@ $buttons: (
)
)
);


/**
* Separator
*/

$separators: (
base: (
color : color(neutral, light),
style : solid,
width : 1px
)
);
4 changes: 3 additions & 1 deletion src/scss/chopchop-ui.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import "var";
@import "helper/function";
@import "helper/variable-function";
@import "setting";
@import "helper/setting-function";
@import "helper/flex";
@import "helper/breakpoint";
@import "helper/shape";
Expand Down
8 changes: 0 additions & 8 deletions src/scss/helper/_button.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* Button color
*/

@function button($button: 'base', $state: 'default', $var: 'color') {
@return map-get(map-get(map-get($buttons, $button), $state), $var);
}

/**
* Generate colours for buttons
*/
Expand Down
16 changes: 16 additions & 0 deletions src/scss/helper/_setting-function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Button
*/

@function button($button: 'base', $state: 'default', $var: 'color') {
@return map-get(map-get(map-get($buttons, $button), $state), $var);
}


/**
* Separator
*/

@function seperator($seperator, $var: 'width') {
@return map-get(map-get($separators, $seperator), $var);
}
File renamed without changes.
10 changes: 2 additions & 8 deletions src/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
*/

@import "var";


/**
* Functions to reference arrays
*/

@import "helper/function";
@import "helper/variable-function";


/**
* Settings for specific components and utilities
*/

@import "setting";

@import "helper/setting-function";

/**
* Helper Mixins
Expand Down
40 changes: 21 additions & 19 deletions src/scss/utility/_separator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@
* @since 3.0.0
*/

.u-separator,
%u-separator {
border: 1px solid color(neutral, light);
@function seperator($seperator, $var: 'width') {
@return map-get(map-get($separators, $seperator), $var);
}

.u-separator-top,
%u-separator-top {
border-top: 1px solid color(neutral, light);
}
$seperator-sides: (base, top, left, bottom, right);

.u-separator-bottom,
%u-separator-bottom {
border-bottom: 1px solid color(neutral, light);
}
@each $key, $value in $separators {
$class: 'u-separator-' + $key;
@if($key == base) {
$class: 'u-separator';
}

.u-separator-left,
%u-separator-left {
border-left: 1px solid color(neutral, light);
@each $side in $seperator-sides {
@if($side == base) {
.#{$class},
%#{$class} {
border: seperator($key, width) seperator($key, style) seperator($key, color);
}
} @else {
.#{$class}-#{$side},
%#{$class}-#{$side} {
border-#{$side}: seperator($key, width) seperator($key, style) seperator($key, color);
}
}
}
}

.u-separator-right,
%u-separator-right {
border-right: 1px solid color(neutral, light);
}

0 comments on commit d57d895

Please sign in to comment.