Skip to content

Commit

Permalink
Merge pull request #20 from renatocarvalho/fix-test-and-adjust-code
Browse files Browse the repository at this point in the history
Fix test and adjust code
  • Loading branch information
felics committed Aug 19, 2015
2 parents ab4a95b + 682163a commit 5859855
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

# Matches multiple files with brace expansion notation
[*.{js,jade}]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ By default, the grid is just a light wrapper around flexbox, so go nuts with fle
- **space-around:** Distribute items by using variable space around them.
- **space-between:** Distribute items by using variable space between them.
- **auto:** Let flexbox attempt to align items when no width / static widths are set on them. If you set a static width, it will be used as "min-width" by flexbox. Flexbox will still grow it to fill the container together with all other items. Set max-width&width on one or more items to let flexbox layout all other items around them. If you set @i(false) on all items, flexbox will evenly layout the items.

#### Example (auto):

```scss

.auto-grid {
Expand Down Expand Up @@ -127,7 +127,7 @@ By default, the grid is just a light wrapper around flexbox, so go nuts with fle

- **stretch:** Assign stretch mixin to a group of grid-items in a grid to stretch-align their contents.
- **bp:** Usage: @include bp(breakpoint){ @content; }

#### Example (stretch):

```scss
Expand Down
8 changes: 3 additions & 5 deletions __test__/src/scss/test.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@


$color-primary: #C31C13;
$color-secondary: #971416;
$color-shade: #6A0D18;
$color-border: #3D051A;


@import "normalize";
@import "../../../src/hagrid";
@import "tests/widths";
@import "tests/pushpull";
@import "tests/modifiers";


body {
margin: 2em;
background: $color-primary;
Expand All @@ -27,13 +23,15 @@ body {
min-height: 2em;
border-radius: .25em;
margin-bottom: .5rem;

&.large {
height: 6em;
}
}

header {
text-align: center!important;
text-align: center !important;

h1,
h2 {
display: inline-block;
Expand Down
13 changes: 11 additions & 2 deletions __test__/src/scss/tests/_modifiers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

&-item {
@include i(1/3);

&:last-child {
.block {
background: $color-primary;
Expand All @@ -20,6 +21,7 @@
&-right {
@include g(right);
}

&-center {
@include g(center);
}
Expand All @@ -34,18 +36,22 @@

&-auto {
@include g(auto);

.modifier-header {
@include i();
}

.auto-item {
@include i(140px);
}

.first {
max-width: 140px;
}

.second {
@include i(false, 10% desk);
@include bp(desk) {
@include i(false, 10% lg);
@include bp(lg) {
max-width: 10%;
}
}
Expand All @@ -61,6 +67,7 @@

&-stretch {
@include g();

> .modifier-item {
@include stretch;
}
Expand All @@ -81,9 +88,11 @@
&-xrev {
@include g(rev);
}

&-yrev {
@include g(flip);
}

&-rev {
@include g(rev, flip);
}
Expand Down
24 changes: 14 additions & 10 deletions __test__/src/scss/tests/_pushpull.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
margin-bottom: 1.5rem;
}


&-four-five {
@include push(lap 3/5, desk 4/5);
@include push(md 3/5, lg 4/5);
}

&-three-four {
@include push(lap 2/4, desk 3/4);
@include push(md 2/4, lg 3/4);
}

&-two-three {
@include push(lap 1/3, desk 2/3);
@include push(md 1/3, lg 2/3);
}

&-one-two {
@include push(desk 1/2);
@include push(lg 1/2);
}
}

Expand All @@ -24,18 +26,20 @@
@include g(right);
margin-bottom: 1.5rem;
}

&-three-four {
@include pull(3/4, lap 2/4, desk 3/4);
@include pull(3/4, md 2/4, lg 3/4);
}

&-two-three {
@include pull(2/3, lap 1/3, desk 2/3);

@include pull(2/3, md 1/3, lg 2/3);
}

&-one-two {
@include pull(1/2, lap 0, desk 1/2);
@include pull(1/2, md 0, lg 1/2);
}

&-four-five {
@include pull(4/5, lap 3/5, desk 4/5);
@include pull(4/5, md 3/5, lg 4/5);
}
}
29 changes: 16 additions & 13 deletions __test__/src/scss/tests/_widths.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
@include g();
margin-bottom: 1.5rem;
}

&-item {
@include i();
}

&-column {
@include i(100%, lap 1/2);
@include i(100%, md 1/2);

&:first-child {
@include i(100%, lap 1/2)
@include i(100%, md 1/2)
}
}
}
Expand Down Expand Up @@ -48,45 +51,45 @@
}

.one-six {
@include i(1, desk 1/6);
@include i(1, lg 1/6);
}

.five-six {
display: none;
@include i(1, desk 5/6);
@include bp(desk) {
@include i(1, lg 5/6);
@include bp(lg) {
display: block;
}
}

.one-seven {
@include i(1/2, desk 1/7)
@include i(1/2, lg 1/7)
}

.six-seven {
@include i(1/2, desk 6/7)
@include i(1/2, lg 6/7)
}

.one-eight {
@include i(1/3, desk 1/8)
@include i(1/3, lg 1/8)
}

.seven-eight {
@include i(2/3, desk 7/8)
@include i(2/3, lg 7/8)
}

.one-nine {
@include i(1/4, desk 1/9)
@include i(1/4, lg 1/9)
}

.eight-nine {
@include i(3/4, desk 8/9)
@include i(3/4, lg 8/9)
}

.one-ten {
@include i(1/5, desk 1/10)
@include i(1/5, lg 1/10)
}

.nine-ten {
@include i(4/5, desk 9/10)
@include i(4/5, lg 9/10)
}
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hagrid",
"version": "0.11.0",
"version": "0.11.1",
"authors": [
"felics <[email protected]>"
],
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "hagrid",
"version": "0.11.0",
"version": "0.11.1",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/felics/hagrid"
Expand All @@ -16,8 +17,8 @@
"devDependencies": {
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-jade": "^1.0.1",
"gulp-jade": "^1.1.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.2"
"gulp-sass": "^2.0.4"
}
}
2 changes: 2 additions & 0 deletions src/hagrid/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@
align-self: stretch;
display: flex;
flex-flow: row wrap;

> * {
flex: 1 1 100%;
}

@if $hagrid-fallback and $hagrid-fallback-warnings {
@warn "Stretch won't work on fallback-grid!"
}
Expand Down
4 changes: 2 additions & 2 deletions src/hagrid/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ $hagrid-placeholders: ();
// * Handle responsive args
@else {

// * "lap 2/3"-synthax
// * "md 2/3"-synthax
$key: nth($width, 1);
$value: nth($width, 2);

// * Cater for "2/3 lap"-synthax
// * Cater for "2/3 md"-synthax
@if type-of($key) == number {
$value: nth($width, 1);
$key: nth($width, 2);
Expand Down
5 changes: 4 additions & 1 deletion src/hagrid/_modifiers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
right: (-$hagrid-gutter/2);
};
}

}

@mixin grid-modifier($modifier) {
Expand Down Expand Up @@ -119,6 +118,7 @@
left: 0;
right: 0;
};

> * {
padding: {
left: 0!important;
Expand All @@ -131,6 +131,7 @@
left: (-$hagrid-gutter);
right: (-$hagrid-gutter);
};

> * {
padding: {
left: $hagrid-gutter!important;
Expand All @@ -143,6 +144,7 @@
left: (-$hagrid-gutter/4);
right: (-$hagrid-gutter/4);
};

> * {
padding: {
left: ($hagrid-gutter/4)!important;
Expand Down Expand Up @@ -187,6 +189,7 @@
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
align-items: flex-end;
}

@if $hagrid-fallback and $hagrid-fallback-warnings {
@warn "Modifier #{$modifier} won't work on fallback-grid!"
}
Expand Down

0 comments on commit 5859855

Please sign in to comment.