This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Closes #200
- Loading branch information
Reda Lemeden
committed
Jul 25, 2014
1 parent
164d0f6
commit 25496b1
Showing
6 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
@import "grid/to-deprecate"; | ||
@import "grid/visual-grid"; | ||
@import "grid/display"; | ||
@import "grid/direction"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Changes the direction property used by other mixins called in the code block argument. | ||
* | ||
* @param {String} $direction (left-to-right) - Layout direction to be used within the block. Can be `left-to-right` or `right-to-left`. | ||
* | ||
* @example scss | ||
* @include direction(right-to-left) { | ||
* .right-to-left-block { | ||
* @include span-columns(6); | ||
* } | ||
* } | ||
* | ||
* @example css | ||
* // CSS | ||
* .right-to-left-block { | ||
* float: right; | ||
* ... | ||
* } | ||
*/ | ||
|
||
@mixin direction($direction: left-to-right) { | ||
$scope-direction: $layout-direction; | ||
|
||
@if $direction == left-to-right { | ||
$layout-direction: LTR !global; | ||
} @else if $direction == right-to-left { | ||
$layout-direction: RTL !global; | ||
} | ||
|
||
@content; | ||
|
||
$layout-direction: $scope-direction !global; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'spec_helper' | ||
|
||
describe "@include direction() {...}" do | ||
before(:all) do | ||
ParserSupport.parse_file("direction") | ||
end | ||
|
||
context "with no argument" do | ||
it "uses default direction setting" do | ||
expect('.default-block').to have_rule('float: left') | ||
end | ||
end | ||
|
||
context "whith argument (right-to-left)" do | ||
it "changes direction setting inside the block" do | ||
expect('.right-to-left-block').to have_rule('float: right') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@import 'setup'; | ||
|
||
@include direction() { | ||
.default-block { | ||
@include span-columns(6); | ||
} | ||
} | ||
|
||
@include direction(right-to-left) { | ||
.right-to-left-block { | ||
@include span-columns(6); | ||
} | ||
} |