compass-recipes 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/LICENSE +3 -0
  2. data/README.md +21 -0
  3. data/VERSION +1 -0
  4. data/lib/compass-recipes.rb +2 -0
  5. data/stylesheets/_recipes.scss +9 -0
  6. data/stylesheets/recipes/_effect.scss +1 -0
  7. data/stylesheets/recipes/_enhancement.scss +1 -0
  8. data/stylesheets/recipes/_form.scss +2 -0
  9. data/stylesheets/recipes/_icons.scss +29 -0
  10. data/stylesheets/recipes/_layout.scss +1 -0
  11. data/stylesheets/recipes/_pattern.scss +0 -0
  12. data/stylesheets/recipes/_shadow.scss +2 -0
  13. data/stylesheets/recipes/_shape.scss +9 -0
  14. data/stylesheets/recipes/_shared.scss +4 -0
  15. data/stylesheets/recipes/_ui.scss +5 -0
  16. data/stylesheets/recipes/effect/_glass.scss +26 -0
  17. data/stylesheets/recipes/enhancement/_corner-folded.scss +59 -0
  18. data/stylesheets/recipes/form/_element.scss +2 -0
  19. data/stylesheets/recipes/form/_skin.scss +1 -0
  20. data/stylesheets/recipes/form/element/_border-color.scss +53 -0
  21. data/stylesheets/recipes/form/element/_inline.scss +25 -0
  22. data/stylesheets/recipes/form/skin/_default.scss +0 -0
  23. data/stylesheets/recipes/form/skin/_natural.scss +143 -0
  24. data/stylesheets/recipes/layout/_vertical-align.scss +62 -0
  25. data/stylesheets/recipes/shadow/_drop.scss +9 -0
  26. data/stylesheets/recipes/shadow/_top-edge.scss +28 -0
  27. data/stylesheets/recipes/shadow/drop/_lifted.scss +42 -0
  28. data/stylesheets/recipes/shape/_triangle.scss +63 -0
  29. data/stylesheets/recipes/shared/_block-inline-block.scss +6 -0
  30. data/stylesheets/recipes/shared/_clearfix.scss +30 -0
  31. data/stylesheets/recipes/shared/_list-inline-block.scss +12 -0
  32. data/stylesheets/recipes/shared/_pseudo-element.scss +18 -0
  33. data/stylesheets/recipes/ui/_convex.scss +23 -0
  34. data/stylesheets/recipes/ui/_glossy.scss +24 -0
  35. data/stylesheets/recipes/ui/_gradient.scss +6 -0
  36. data/stylesheets/recipes/ui/_menu-dropdown.scss +44 -0
  37. data/stylesheets/recipes/ui/border/_bevel.scss +6 -0
  38. metadata +118 -0
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2010-2011 Maxime Thirouin
2
+
3
+ http://creativecommons.org/licenses/by/3.0/
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Compass Recipes ![project status](http://stillmaintained.com/MoOx/Compass-Recipes.png) #
2
+
3
+ This project is a collection of Sass mixins using Compass that you can use or learn from.
4
+
5
+ ## Demos
6
+
7
+ http://moox.github.com/Compass-Recipes/
8
+
9
+ ## TODO
10
+ * Create tests for all existing mixins
11
+ * Add all pattern mixins from http://leaverou.me/css3patterns
12
+ * Add all shadow/drop mixins from http://nicolasgallagher.com/css-drop-shadows-without-images/demo/ and http://www.creativejuiz.fr/trytotry/css3-box-shadow-after-before/
13
+ * Add all shapes from http://css-tricks.com/examples/ShapesOfCSS/
14
+ * Add normalize.css from @necolas
15
+
16
+ ## Author
17
+
18
+ Compass-Recipes is maintained by Maxime Thirouin, a front-end web developer working for Shopbot-inc.com
19
+
20
+ ## Open to All
21
+ Anyone who forks this project and submits a patch and pull request will be given commit access after the first patch is accepted.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,2 @@
1
+ require "compass"
2
+ Compass::Frameworks.register("recipes", :path => "#{File.dirname(__FILE__)}/..")
@@ -0,0 +1,9 @@
1
+ @import "recipes/effect";
2
+ @import "recipes/enhancement";
3
+ @import "recipes/form";
4
+ @import "recipes/layout";
5
+ @import "recipes/pattern";
6
+ @import "recipes/shadow";
7
+ @import "recipes/shape";
8
+ @import "recipes/shared";
9
+ @import "recipes/ui";
@@ -0,0 +1 @@
1
+ @import "recipes/effect/glass";
@@ -0,0 +1 @@
1
+ @import "recipes/enhancement/corner-folded";
@@ -0,0 +1,2 @@
1
+ @import "recipes/form/element";
2
+ @import "recipes/form/skin";
@@ -0,0 +1,29 @@
1
+ @mixin icon($background-position: 0 50%, $display: inline-block)
2
+ {
3
+ background-repeat: no-repeat;
4
+ background-position: $background-position;
5
+ display: $display;
6
+ vertical-align: middle;
7
+ }
8
+
9
+ @mixin icon-inline($side: left, $width: 24px, $height: auto, $background-position: 2px 50%, $display: inline-block)
10
+ {
11
+ @if $height == auto
12
+ {
13
+ $height: $width;
14
+ }
15
+
16
+ @include icon($background-position, $display);
17
+ padding-#{$side}: $width;
18
+ line-height: $height;
19
+ }
20
+
21
+ @mixin icon-left($width: 24px, $height: auto, $background-position: 2px 50%, $display: inline-block)
22
+ {
23
+ @include icon-inline(left, $width, $height, $background-position, $display);
24
+ }
25
+
26
+ @mixin icon-right($width: 24px, $height: auto, $background-position: 100% 50%, $display: inline-block)
27
+ {
28
+ @include icon-inline(right, $width, $height, $background-position, $display);
29
+ }
@@ -0,0 +1 @@
1
+ @import "recipes/layout/vertical-align";
File without changes
@@ -0,0 +1,2 @@
1
+ @import "shadow/drop";
2
+ @import "shadow/top-edge";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bundles of shapes
3
+ *
4
+ * @todo all other shapes that are not here !
5
+ *
6
+ * @thanks Chris Coyier
7
+ * @link http://css-tricks.com/examples/ShapesOfCSS/
8
+ */
9
+ @import "recipes/shape/triangle";
@@ -0,0 +1,4 @@
1
+ @import "recipes/shared/block-inline-block";
2
+ @import "recipes/shared/clearfix";
3
+ @import "recipes/shared/list-inline-block";
4
+ @import "recipes/shared/pseudo-element";
@@ -0,0 +1,5 @@
1
+ @import "recipes/ui/border";
2
+ @import "recipes/ui/convex";
3
+ @import "recipes/ui/glossy";
4
+ @import "recipes/ui/gradient";
5
+ @import "recipes/ui/menu-dropdown";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Glass effect
3
+ * Use this on image for better effect render
4
+ *
5
+ * Inspired from Simurai's Imdb redisign
6
+ *
7
+ * @link http://lab.simurai.com/redesign/imdb
8
+ * @thanks Simurai @simurai
9
+ */
10
+ @mixin effect-glass($color: #fff, $reflectDegree: -45deg, $border-radius: 4px)
11
+ {
12
+ position: relative;
13
+ @include border-radius($border-radius);
14
+
15
+ &:before
16
+ {
17
+ content: "";
18
+ position:absolute;
19
+ z-index: 1; // really need that ?
20
+ top: 0; right: 0; bottom: 0; left: 0;
21
+ border: transparent solid 1px;
22
+ @include border-radius($border-radius);
23
+ @include box-shadow(inset $color 0 0 2px, inset rgba($color,.4) 0 5px 10px);
24
+ @include background(linear-gradient($reflectDegree, rgba($color,.12) 50%, rgba($color, 0) 50.5% ));
25
+ }
26
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Corner folded with pure CSS
3
+ *
4
+ * Known support: Firefox 3.5+, Chrome 4+, Safari 4+, Opera 10+, IE 9+.
5
+ * IE8 is not supported because it not render properly box-shadow and
6
+ * pseudo element should be selected with ::element and not :element
7
+ *
8
+ * @thanks to Nicolas Gallagher
9
+ * @link http://nicolasgallagher.com/pure-css-folded-corner-effect/demo/
10
+ */
11
+
12
+ @import "recipes/shared/pseudo-element";
13
+
14
+ @mixin corner-folded($position: top-right, $color: #ddd, $background-color: #fff, $width: 1em, $border-radius: .3em, $box-shadow: rgba(0, 0, 0, .3) 0 0 .6em)
15
+ {
16
+ position: relative;
17
+ overflow: hidden;
18
+
19
+ &::before
20
+ {
21
+ @include pseudo-element;
22
+ border-style: solid;
23
+
24
+ @include box-shadow($box-shadow);
25
+
26
+ @if ($position == 'top-right')
27
+ {
28
+ top: 0;
29
+ right: 0;
30
+ border-width: 0 $width $width 0;
31
+ border-color: $color $background-color;
32
+ @include border-radius(0 0 0 $border-radius);
33
+ }
34
+ @elseif ($position == 'top-left')
35
+ {
36
+ top: 0;
37
+ left: 0;
38
+ border-width: $width $width 0 0;
39
+ border-color: $background-color $color;
40
+ @include border-radius(0 0 $border-radius 0);
41
+ }
42
+ @elseif ($position == 'bottom-right')
43
+ {
44
+ bottom: 0;
45
+ right: 0;
46
+ border-width: 0 0 $width $width;
47
+ border-color: $background-color $color;
48
+ @include border-radius($border-radius 0 0 0);
49
+ }
50
+ @elseif ($position == 'bottom-left')
51
+ {
52
+ bottom: 0;
53
+ left: 0;
54
+ border-width: $width 0 0 $width;
55
+ border-color: $color $background-color;
56
+ @include border-radius(0 $border-radius 0 0);
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,2 @@
1
+ @import "recipes/form/element/border-color";
2
+ @import "recipes/form/element/inline";
@@ -0,0 +1 @@
1
+ @import "recipes/form/skin/default";
@@ -0,0 +1,53 @@
1
+ @import "recipes/ui/border/bevel";
2
+
3
+
4
+ @mixin fancyElement($border-color: #006ea9, $border-color-active: #ffa43e, $line-height: 24px, $border-width: 1px, $border-width-active: 3px)
5
+ {
6
+ color: #515151;
7
+ font-size: 12px;
8
+
9
+ line-height: $line-height;
10
+ height: $line-height;
11
+ outline: $border-width solid $border-color;
12
+ border: $border-width-active - $border-width solid transparent;
13
+
14
+ &:focus
15
+ {
16
+ outline: $border-width solid $border-color-active;
17
+ @include fancyInputBorder($border-width-active - $border-width, $border-color-active);
18
+ }
19
+ }
20
+
21
+ @mixin fancyInput($border-color: #006ea9, $border-color-active: #ffa43e, $line-height: 24px, $border-width: 1px, $border-width-active: 3px)
22
+ {
23
+
24
+ background: -webkit-gradient(linear, left top, left 25%, from(#ebebeb), to(#fff) );
25
+ background: -moz-linear-gradient(top, #ebebeb, #fff .25em);
26
+ background: linear-gradient(top, #fff, #ebebeb, #fff .25em);
27
+ }
28
+
29
+ @mixin fancyForm($border-color: #006ea9, $border-color-active: #ffa43e, $line-height: 24px, $border-width: 1px, $border-width-active: 3px)
30
+ {
31
+ input,
32
+ textarea,
33
+ select
34
+ {
35
+ @include fancyElement($border-color, $border-color-active, $line-height, $border-width, $border-width-active);
36
+ }
37
+
38
+ input,
39
+ textarea
40
+ {
41
+ @include fancyInput($border-color, $border-color-active, $line-height, $border-width, $border-width-active);
42
+ }
43
+
44
+ button
45
+ {
46
+ @extend .button-blue;
47
+
48
+ &:hover
49
+ {
50
+ @extend .button-orange;
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,25 @@
1
+ @mixin form-element-inline($label-width: 8em, $input-width: 20em)
2
+ {
3
+ label
4
+ {
5
+ display: inline-block;
6
+ width: $label-width;
7
+
8
+ // we use valign top for label + textarea
9
+ vertical-align: top;
10
+
11
+ // so we add a padding top to make the label no valigned on top of the input
12
+ padding-top: .4em;
13
+ }
14
+
15
+ input,
16
+ textarea
17
+ {
18
+ width: $input-width;
19
+ }
20
+
21
+ textarea
22
+ {
23
+ height: 50px;
24
+ }
25
+ }
File without changes
@@ -0,0 +1,143 @@
1
+ @mixin form-skin-natural-input($color: #999, $border: #3399e9)
2
+ {
3
+ padding: .4em;
4
+
5
+ border: 1px solid $border;
6
+ border-top-color: lighten($border, 4%);
7
+ border-bottom-color: darken($border, 4%);
8
+
9
+ @include border-radius(.4em);
10
+ @include background(linear-gradient(#fff, darken(#fff, 10%) 1%, #fff 30%));
11
+
12
+ @include box-shadow(rgba(0, 0, 0, .1) 0 0 .4em); // , inset rgba(0, 0, 0, .2) 0 1px 2px
13
+
14
+ $border-transition: border linear .2s;
15
+ $box-shadow-transition: box-shadow linear .2s;
16
+ $transition: $box-shadow-transition, $border-transition;
17
+ -moz-transition: -moz-$transition;
18
+ -webkit-transition: -webkit-$transition;
19
+ transition: $transition;
20
+ }
21
+
22
+ @mixin form-skin-natural-input-hover($border: #3399e9)
23
+ {
24
+ @include box-shadow(0 0 .8em rgba($border,.4));
25
+ }
26
+
27
+ @mixin form-skin-natural-input-focus($border: #3399e9)
28
+ {
29
+ outline:none; // reset default browser behavior
30
+ border-color: $border;
31
+ @include box-shadow(0 0 .4em rgba($border,.65));
32
+ }
33
+
34
+ @mixin form-skin-natural-label($color: #999)
35
+ {
36
+ cursor: pointer;
37
+ color: $color;
38
+ }
39
+
40
+ // here we can make better selector because when including mixin, & is too long
41
+ @mixin form-skin-natural-label-adjacent-effect($color-hover, $color-focus)
42
+ {
43
+ label:hover input, // <label><input /></label>
44
+ label:hover select, // <label><select /></label>
45
+ label:hover textarea, // <label><textarea /></label>
46
+ input:hover + label, // <input /> <label> </label>
47
+ select:hover + label, // <select /> <label> </label>
48
+ textarea:hover + label // <textarea /> <label> </label>
49
+ /* CANT WORK :( we need oposited of the + adjacent selector
50
+ label + input:hover, // <label> </label> <input />
51
+ label + select:hover, // <label> </label> <select />
52
+ label + textarea:hover, // <label> </label> <textarea />
53
+ */
54
+ {
55
+ color: $color-hover;
56
+ }
57
+
58
+ label:focus input, // <label><input /></label>
59
+ label:focus select, // <label><select /></label>
60
+ label:focus textarea, // <label><textarea /></label>
61
+ input:focus + label, // <input /> <label> </label>
62
+ select:focus + label, // <select /> <label> </label>
63
+ textarea:focus + label // <textarea /> <label> </label>
64
+ /* CANT WORK :( we need oposited of the + adjacent selector
65
+ label + input:focus, // <label> </label> <input />
66
+ label + select:focus, // <label> </label> <select />
67
+ label + textarea:focus, // <label> </label> <textarea />
68
+ */
69
+ {
70
+ color: $color-focus;
71
+ }
72
+ }
73
+
74
+ @mixin form-skin-natural-button($color: #fff, $background: #3399e9)
75
+ {
76
+
77
+ cursor: pointer;
78
+ display: inline-block;
79
+ width: auto;
80
+
81
+ color: $color;
82
+
83
+ padding: .6em 1em;
84
+
85
+ text-shadow: 0 1px 0 rgba(darken($background, 80%), .4);
86
+
87
+ border: 1px solid darken($background, 5%);
88
+ border-top-color: darken($background, 10%);
89
+ border-bottom-color: lighten($background, 10%);
90
+ background: $background; //fallback
91
+ @include background(linear-gradient(lighten($background, 10%), darken($background, 10%)));
92
+
93
+ @include border-radius(.6em);
94
+ @include box-shadow(rgba(0, 0, 0, .4) 0 .1em .2em);
95
+
96
+ &:focus,
97
+ &:hover
98
+ {
99
+ text-decoration: none; // for <a>
100
+ background: darken($background, 5%); //fallback
101
+ @include background(linear-gradient(lighten($background, 12%), darken($background, 12%)));
102
+ }
103
+
104
+ &:active
105
+ {
106
+ text-decoration: none; // for <a>
107
+ background: darken($background, 8%); //fallback
108
+ @include background(linear-gradient(darken($background, 12%), lighten($background, 12%)));
109
+ }
110
+ }
111
+
112
+
113
+ @mixin form-skin-natural($color-label: #666, $color-input: #999, $border-input: #3399e9, $color-button: #fff, $background-button: #3399e9)
114
+ {
115
+ label
116
+ {
117
+ @include form-skin-natural-label($color-label);
118
+ }
119
+
120
+ input,
121
+ select,
122
+ textarea
123
+ {
124
+ @include form-skin-natural-input($color-input, $border-input);
125
+
126
+ &:hover,
127
+ label:hover + &
128
+ {
129
+ @include form-skin-natural-input-hover($border-input);
130
+ }
131
+
132
+ &:focus
133
+ {
134
+ @include form-skin-natural-input-focus($border-input);
135
+ }
136
+ }
137
+
138
+ button,
139
+ .button
140
+ {
141
+ @include form-skin-natural-button($color-button, $background-button);
142
+ }
143
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Vertical alignement for page
3
+ * Inspired by http://css-tricks.com/snippets/css/center-div-with-dynamic-height/
4
+ *
5
+ * Usage:
6
+ *
7
+ * SCSS
8
+ * @include vertical-align-requirement;
9
+ * .v-align-container { @include vertical-align-container }
10
+ * .v-align-content-container { @include vertical-align-content-container }
11
+ * .v-align-content { @include vertical-align-content }
12
+ *
13
+ * HTML
14
+ * <body>
15
+ * <div class="v-align-container">
16
+ * <div class="v-align-container">
17
+ * <div class="v-align-container">
18
+ * Your content !
19
+ * </div>
20
+ * </div>
21
+ * </div>
22
+ * </body>
23
+ */
24
+
25
+ @mixin vertical-align-requirement
26
+ {
27
+ html,
28
+ body
29
+ {
30
+ height:100%
31
+ }
32
+ }
33
+
34
+ @mixin vertical-align-container
35
+ {
36
+
37
+ display: table;
38
+ overflow: hidden;
39
+ margin-left: auto;
40
+ margin-right: auto;
41
+ height: 100%;
42
+
43
+ // ie6 ie7
44
+ *position:relative;
45
+ }
46
+
47
+ @mixin vertical-align-content-container
48
+ {
49
+ display: table-cell;
50
+ vertical-align: middle;
51
+
52
+ // ie6 ie7
53
+ *position: absolute;
54
+ *top: 50%;
55
+ }
56
+
57
+ @mixin vertical-align-content
58
+ {
59
+ // ie6 ie7
60
+ *position: relative;
61
+ *top: -50%;
62
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Drop shadow mixins from Nicolas Gallagher demo
3
+ *
4
+ * Thanks to him (@necolas), @simurai, @cameronmoll and @matthamm
5
+ *
6
+ * @link http://nicolasgallagher.com/css-drop-shadows-without-images/demo/
7
+ */
8
+
9
+ @import "recipes/shadow/drop/lifted";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shadow along the top edge of the browser viewport
3
+ *
4
+ * @link http://playground.genelocklin.com/depth/
5
+ */
6
+
7
+ @mixin top-shadow($height: 1em, $color: rgba(0,0,0,.8), $z-index: 100, $position: fixed)
8
+ {
9
+ content: "";
10
+
11
+ position: $position;
12
+ left: 0%;
13
+ width: 100%;
14
+
15
+ top: -$height;
16
+ height: $height;
17
+ @include box-shadow(0 0 $height $color);
18
+
19
+ z-index: $z-index;
20
+ }
21
+
22
+ /*
23
+ // Usage
24
+ body:before
25
+ {
26
+ @include top-shadow;
27
+ }
28
+ */
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Drop shadow mixins from Nicolas Gallagher demo
3
+ *
4
+ * @link http://nicolasgallagher.com/css-drop-shadows-without-images/demo/
5
+ */
6
+ @mixin drop-shadow-lifted($height: 15px, $margin: 10px, $angle: 3deg)
7
+ {
8
+ & > :last-child::before
9
+ {
10
+ content:"";
11
+ position: absolute;
12
+ z-index: -1;
13
+ top: 0;
14
+ bottom: 0;
15
+ left: 0;
16
+ right: 0;
17
+ }
18
+
19
+ &::before,
20
+ &::after
21
+ {
22
+ content:"";
23
+ position:absolute;
24
+ z-index: -2;
25
+
26
+ bottom: $height;
27
+ left: $margin;
28
+ width: 50%;
29
+ height: 20%;
30
+
31
+ @include box-shadow(0 $height 10px rgba(0, 0, 0, .7));
32
+ @include transform(rotate(-$angle));
33
+ }
34
+
35
+ &::after
36
+ {
37
+ right: $margin;
38
+ left: auto;
39
+
40
+ @include transform(rotate($angle));
41
+ }
42
+ }
@@ -0,0 +1,63 @@
1
+ @mixin triangle($direction: top, $width: 1em, $height: 0, $color: #000)
2
+ {
3
+ @if ($height == 0)
4
+ {
5
+ $height: $width;
6
+ }
7
+
8
+ width: 0;
9
+ height: 0;
10
+
11
+ @if ($direction == 'top')
12
+ {
13
+ border-left: $width solid transparent;
14
+ border-right: $width solid transparent;
15
+ border-bottom: $height solid $color;
16
+ }
17
+ @elseif ($direction == 'bottom')
18
+ {
19
+ border-left: $width solid transparent;
20
+ border-right: $width solid transparent;
21
+ border-top: $height solid $color;
22
+ }
23
+ @elseif ($direction == 'left')
24
+ {
25
+ border-top: $width solid transparent;
26
+ border-right: $height solid $color;
27
+ border-bottom: $width solid transparent;
28
+ }
29
+ @elseif ($direction == 'right')
30
+ {
31
+ border-top: $width solid transparent;
32
+ border-left: $height solid $color;
33
+ border-bottom: $width solid transparent;
34
+ }
35
+ @elseif ($direction == 'top-left')
36
+ {
37
+ border-top: $width solid $color;
38
+ border-bottom: $width solid transparent;
39
+ border-left: $width solid $color;
40
+ border-right: $width solid transparent;
41
+ }
42
+ @elseif ($direction == 'top-right')
43
+ {
44
+ border-top: $width solid $color;
45
+ border-bottom: $width solid transparent;
46
+ border-left: $width solid transparent;
47
+ border-right: $width solid $color;
48
+ }
49
+ @elseif ($direction == 'bottom-left')
50
+ {
51
+ border-top: $width solid transparent;
52
+ border-bottom: $width solid $color;
53
+ border-left: $width solid $color;
54
+ border-right: $width solid transparent;
55
+ }
56
+ @elseif ($direction == 'bottom-right')
57
+ {
58
+ border-top: $width solid transparent;
59
+ border-left: $width solid transparent;
60
+ border-bottom: $width solid $color;
61
+ border-right: $width solid $color;
62
+ }
63
+ }
@@ -0,0 +1,6 @@
1
+ // native block element can use inline-block with IE6/7
2
+ @mixin block-inline-block
3
+ {
4
+ display: inline-block;
5
+ *display: inline;
6
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Micro clearfix hack
3
+ *
4
+ * The clearfix hack is a popular way to clear floats without resorting to using presentational markup. This article presents an update to the clearfix method that further reduces the amount of CSS required.
5
+ * Known support: Firefox 2+, Safari 2+, Chrome, Opera 9.27+, IE 6+, IE Mac.
6
+ *
7
+ * @link http://nicolasgallagher.com/micro-clearfix-hack/
8
+ */
9
+ @mixin clearfix
10
+ {
11
+ // For modern browsers
12
+ &:before,
13
+ &:after
14
+ {
15
+ content:"";
16
+ display:block;
17
+ overflow:hidden;
18
+ }
19
+
20
+ &:after
21
+ {
22
+ clear:both;
23
+ }
24
+
25
+ //For IE 6/7 (trigger hasLayout)
26
+ &
27
+ {
28
+ zoom: 1;
29
+ }
30
+ }
@@ -0,0 +1,12 @@
1
+ @import "recipes/shared/block-inline-block";
2
+
3
+ // use this for ul,ol (ex: nav menu)
4
+ @mixin list-inline-block
5
+ {
6
+ @include block-inline-block;
7
+
8
+ li
9
+ {
10
+ @include block-inline-block;
11
+ }
12
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Note IE7/6 doesn't understand pseudo element as ::before and ::after
3
+ * IE8 need to have :before and not ::before
4
+ * So use only : and not :: if you want to support IE8
5
+ * IE9 Webkit Firefox Opera understand ::
6
+ */
7
+ @mixin pseudo-element($width: 0, $height: auto, $content: "")
8
+ {
9
+ content: $content;
10
+ position: absolute;
11
+ display: block;
12
+ width: $width; // default 0 is for ff3 positionning
13
+
14
+ @if ($height != auto)
15
+ {
16
+ height: $height;
17
+ }
18
+ }
@@ -0,0 +1,23 @@
1
+ @mixin ui-convex($color: #ddd, $button-effect: true, $opacity-top: .5, $opacity-bottom: 0, $color-mix: #fff)
2
+ {
3
+ background: $color; // fallback
4
+
5
+ // the original idea was to just add a layer of transparent white to make the convex effect
6
+ // but this didn't work with css3/pie module, so I've used sass color function to get the same result
7
+ //@include background($color linear-gradient(transparentize($color-mix, $opacity-top ), transparentize($color-mix, $opacity-bottom )));
8
+
9
+ $opacity-top: percentage(1-$opacity-top);
10
+ $opacity-bottom: percentage(1-$opacity-bottom);
11
+ $color-top: mix($color, $color-mix, $opacity-top);
12
+ $color-bottom: mix($color, $color-mix, $opacity-bottom);
13
+ @include background(linear-gradient($color-top, $color-bottom));
14
+
15
+ @if $button-effect == true
16
+ {
17
+ &:hover,
18
+ &:focus,
19
+ {
20
+ @include background(linear-gradient($color-bottom, $color-top));
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,24 @@
1
+ @mixin ui-glossy($color: #000, $opacity: .6, $border-width: .1em, $border-color-top: rgba(255,255,255,.5), $border-color-bottom: rgba(85,85,85,.6))
2
+ {
3
+ border-left: 0;
4
+ border-right: 0;
5
+
6
+ border: $border-width solid $border-color-top;
7
+ border-bottom-color: $border-color-bottom;
8
+
9
+ outline: $border-width solid rgba(0,0,0,.6);
10
+ background: $color;
11
+ background: transparentize($color, $opacity);
12
+ //background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(112,112,112,.55)), color-stop(.49, rgba(56,56,56,.46)), color-stop(.51, rgba(0,0,0,.58)), to(rgba(0,0,0,.58)));
13
+ //background: -moz-linear-gradient(rgba(112,112,112,.55), rgba(56,56,56,.46) 49%, rgba(0,0,0,.58) 51%, rgba(0,0,0,.58));
14
+ //background: linear-gradient(rgba(112,112,112,.55), rgba(56,56,56,.46) 49%, rgba(0,0,0,.58) 51%, rgba(0,0,0,.58));
15
+ @include background(linear-gradient(rgba(112,112,112,.55), rgba(56,56,56,.46) 49%, rgba(0,0,0,.58) 51%, rgba(0,0,0,.58) 51%));
16
+ }
17
+ @mixin ui-glossy-inset {
18
+ -moz-border-radius: .5em;
19
+ border-radius: .5em;
20
+ background: -webkit-gradient(linear,0 0, 0 100%,from(#020304),to(#252627));
21
+ background: -moz-linear-gradient(#020304,#252627);
22
+ background: linear-gradient(#020304,#252627);
23
+ border: .1em solid #454545;
24
+ }
@@ -0,0 +1,6 @@
1
+ @mixin ui-gradient-from-middle($color: #ddd, $lighten-top: 10%, $darken-bottom: 10%)
2
+ {
3
+ // fallback
4
+ background: $color;
5
+ @include background(linear-gradient(lighten($color, $lighten-top), darken($color, $darken-bottom)));
6
+ }
@@ -0,0 +1,44 @@
1
+ // sometimes we don't use nesting all the time to optimize some selector
2
+
3
+ // this mixin have to be used with a js for dropdown menu behavior
4
+ // (display onhover with a timeout like 500ms for better UX)
5
+
6
+ @import "recipes/shared/block-inline-block";
7
+
8
+ @mixin ui-menu-dropdown($z-index: 3)
9
+ {
10
+ z-index: $z-index;
11
+
12
+ ul
13
+ {
14
+ z-index: $z-index + 1;
15
+ list-style-position: outside; // ie fix
16
+
17
+ li
18
+ {
19
+ position: relative;
20
+ @include block-inline-block;
21
+ }
22
+
23
+ a
24
+ {
25
+ display: inline-block;
26
+ }
27
+ }
28
+
29
+ // sub menu
30
+ ul ul
31
+ {
32
+ position: absolute;
33
+ z-index: $z-index + 2;
34
+
35
+ // default behavior
36
+ display: none;
37
+ }
38
+
39
+ .no-js li:hover > ul
40
+ {
41
+ display: block;
42
+ }
43
+ }
44
+
@@ -0,0 +1,6 @@
1
+ @mixin ui-border-bevel($width, $color, $variation: 15%)
2
+ {
3
+ border: $width solid $color;
4
+ border-top-color: lighten($color, $variation);
5
+ border-bottom-color: darken($color, $variation);
6
+ }
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-recipes
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Maxime Thirouin
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-01 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: compass
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 49
30
+ segments:
31
+ - 0
32
+ - 11
33
+ - 1
34
+ version: 0.11.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: "A Compass extension to have some sass/compass recipes ready to use ! "
38
+ email: maxime.thirouin@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - README.md
47
+ - LICENSE
48
+ - VERSION
49
+ - lib/compass-recipes.rb
50
+ - stylesheets/_recipes.scss
51
+ - stylesheets/recipes/_effect.scss
52
+ - stylesheets/recipes/_enhancement.scss
53
+ - stylesheets/recipes/_form.scss
54
+ - stylesheets/recipes/_icons.scss
55
+ - stylesheets/recipes/_layout.scss
56
+ - stylesheets/recipes/_pattern.scss
57
+ - stylesheets/recipes/_shadow.scss
58
+ - stylesheets/recipes/_shape.scss
59
+ - stylesheets/recipes/_shared.scss
60
+ - stylesheets/recipes/_ui.scss
61
+ - stylesheets/recipes/effect/_glass.scss
62
+ - stylesheets/recipes/enhancement/_corner-folded.scss
63
+ - stylesheets/recipes/form/_element.scss
64
+ - stylesheets/recipes/form/_skin.scss
65
+ - stylesheets/recipes/form/element/_border-color.scss
66
+ - stylesheets/recipes/form/element/_inline.scss
67
+ - stylesheets/recipes/form/skin/_default.scss
68
+ - stylesheets/recipes/form/skin/_natural.scss
69
+ - stylesheets/recipes/layout/_vertical-align.scss
70
+ - stylesheets/recipes/shadow/_drop.scss
71
+ - stylesheets/recipes/shadow/_top-edge.scss
72
+ - stylesheets/recipes/shadow/drop/_lifted.scss
73
+ - stylesheets/recipes/shape/_triangle.scss
74
+ - stylesheets/recipes/shared/_block-inline-block.scss
75
+ - stylesheets/recipes/shared/_clearfix.scss
76
+ - stylesheets/recipes/shared/_list-inline-block.scss
77
+ - stylesheets/recipes/shared/_pseudo-element.scss
78
+ - stylesheets/recipes/ui/_convex.scss
79
+ - stylesheets/recipes/ui/_glossy.scss
80
+ - stylesheets/recipes/ui/_gradient.scss
81
+ - stylesheets/recipes/ui/_menu-dropdown.scss
82
+ - stylesheets/recipes/ui/border/_bevel.scss
83
+ has_rdoc: true
84
+ homepage: http://moox.github.com/Compass-Recipes
85
+ licenses: []
86
+
87
+ post_install_message:
88
+ rdoc_options: []
89
+
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ requirements: []
111
+
112
+ rubyforge_project: compass-recipes
113
+ rubygems_version: 1.6.2
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Recipes for Compass
117
+ test_files: []
118
+