Skip to content

Commit

Permalink
Add new flow component
Browse files Browse the repository at this point in the history
- Add component
- Add new `$rhythm` metrics
  • Loading branch information
Andy-set-studio committed Jun 24, 2017
1 parent 7511ce7 commit 8ee6df1
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
54 changes: 54 additions & 0 deletions front-end/scss/project/components/_flow.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Define directions with their margin direction
$flow__directions: (
("horizontal", "left"),
("vertical", "top")
);

// Set as either padding or margin
$flow__property: "padding";

.flow {

@include mode("global") {

// Loop each option
@each $direction in $flow__directions {

// Build a class up
&-#{ nth($direction, 1) } {

// By default use $rhythm as it is
&:not([class*="--mini"]):not([class*="--double"]):not([class*="--treble"]) {

> * + * {
padding-#{ nth($direction, 2) }: $rhythm;
}
}

// Halve it
&--mini {

> * + * {
padding-#{ nth($direction, 2) }: $rhythm--mini;
}
}

// Double it
&--double {

> * + * {
padding-#{ nth($direction, 2) }: $rhythm--double;
}
}

// Treble it
&--treble {

> * + * {
padding-#{ nth($direction, 2) }: $rhythm--double;
}
}
}
}
}
}
1 change: 1 addition & 0 deletions front-end/scss/project/imports/_components.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "../components/breathe";
@import "../components/chunk";
@import "../components/display";
@import "../components/flow";
@import "../components/icon";
@import "../components/size";
@import "../components/wrapper";
4 changes: 4 additions & 0 deletions front-end/scss/project/vars/_metrics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ $radius--mini: ($radius / 2);
$radius--midi: ($radius + ($radius / 2));
$radius--double: ($radius * 2);
$radius--treble: ($radius * 3);
$rhythm: 14px;
$rhythm--mini: ($rhythm / 2);
$rhythm--double: ($rhythm * 2);
$rhythm--treble: ($rhythm * 3);

/*------------------------------------*\
BREAKPOINTS
Expand Down

0 comments on commit 8ee6df1

Please sign in to comment.