apollo-grid 1.0.0.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Apollo Grid
3
+ *
4
+ * Actually, this project is a port of Bootstrap 4 grid system for React but is aimed to evolve in its own path.
5
+ * That's why you will find similarities with Bootstrap in here.
6
+ */
7
+
8
+ /**
9
+ * Grid breakpoints
10
+ *
11
+ * Define the minimum and maximum dimensions at which your layout will change,
12
+ * adapting to different screen sizes, for use in media queries.
13
+ */
14
+ $grid-breakpoints: (
15
+ xs: 0,
16
+ sm: 544px,
17
+ md: 768px,
18
+ lg: 992px,
19
+ xl: 1200px
20
+ ) !default;
21
+
22
+ /**
23
+ * Grid containers
24
+ *
25
+ * Define the maximum width of `.container` for different screen sizes.
26
+ */
27
+ $container-max-widths: (
28
+ sm: 576px,
29
+ md: 720px,
30
+ lg: 940px,
31
+ xl: 1140px
32
+ ) !default;
33
+
34
+ /**
35
+ * Grid columns
36
+ *
37
+ * Set the number of columns and specify the width of the gutters.
38
+ */
39
+ $grid-columns: 12 !default;
40
+ $grid-gutter-width: 1.875rem !default; // 30px
41
+
42
+ // Build the grid
43
+ @import './styles/variables';
44
+ @import './styles/mixins/clearfix';
45
+ @import './styles/mixins/breakpoints';
46
+ @import './styles/mixins/grid-framework';
47
+ @import './styles/mixins/grid';
48
+ @import './styles/grid';
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Set the container width, and set media queries behavior for it.
3
+ */
4
+ .container {
5
+ @include make-container();
6
+ @include make-container-max-widths();
7
+
8
+ }
9
+
10
+ /**
11
+ * Utilizes the mixin meant for fixed width containers, but without any defined
12
+ * width for fluid, full width layouts.
13
+ */
14
+ .container-fluid {
15
+ @include make-container();
16
+ }
17
+
18
+
19
+ /**
20
+ * Rows contain and clear the floats of your columns.
21
+ */
22
+ @if $enable-grid-classes {
23
+ .row {
24
+ @include make-row();
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Common styles for small and large grid columns.
30
+ */
31
+ @if $enable-grid-classes {
32
+ @include make-grid-columns();
33
+ }
34
+
35
+ /**
36
+ * Custom styles for additional flex alignment options.
37
+ */
38
+ @if $enable-flex and $enable-grid-classes {
39
+
40
+ // Flex column reordering.
41
+ @each $breakpoint in map-keys($grid-breakpoints) {
42
+ @include media-breakpoint-up($breakpoint) {
43
+ .col-#{$breakpoint}-first {
44
+ order: -1;
45
+ }
46
+
47
+ .col-#{$breakpoint}-last {
48
+ order: 1;
49
+ }
50
+ }
51
+ }
52
+
53
+ // Alignment for every column in row.
54
+ @each $breakpoint in map-keys($grid-breakpoints) {
55
+ @include media-breakpoint-up($breakpoint) {
56
+ .row-#{$breakpoint}-top {
57
+ align-items: flex-start;
58
+ }
59
+
60
+ .row-#{$breakpoint}-center {
61
+ align-items: center;
62
+ }
63
+
64
+ .row-#{$breakpoint}-bottom {
65
+ align-items: flex-end;
66
+ }
67
+ }
68
+ }
69
+
70
+ // Alignment per column.
71
+ @each $breakpoint in map-keys($grid-breakpoints) {
72
+ @include media-breakpoint-up($breakpoint) {
73
+ .col-#{$breakpoint}-top {
74
+ align-self: flex-start;
75
+ }
76
+
77
+ .col-#{$breakpoint}-center {
78
+ align-self: center;
79
+ }
80
+
81
+ .col-#{$breakpoint}-bottom {
82
+ align-self: flex-end;
83
+ }
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Maximum breakpoint width. Null for the largest (last) breakpoint.
3
+ * The maximum value is calculated as the minimum of the next one less 0.1.
4
+ *
5
+ * >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))
6
+ * 767px
7
+ */
8
+ @function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
9
+ $next: breakpoint-next($name, $breakpoints);
10
+ @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);
11
+ }
12
+
13
+ /**
14
+ * Minimum breakpoint width. Null for the smallest (first) breakpoint.
15
+ *
16
+ * >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))
17
+ * 544px
18
+ */
19
+ @function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
20
+ $min: map-get($breakpoints, $name);
21
+ @return if($min != 0, $min, null);
22
+ }
23
+
24
+ /**
25
+ * Breakpoint viewport sizes and media queries.
26
+ * Breakpoints are defined as a map of (name: minimum width), order from small to large:
27
+ *
28
+ * (xs: 0, sm: 544px, md: 768px)
29
+ *
30
+ * The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
31
+ * Name of the next breakpoint, or null for the last breakpoint.
32
+ *
33
+ * >> breakpoint-next(sm)
34
+ * md
35
+ * >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))
36
+ * md
37
+ * >> breakpoint-next(sm, $breakpoint-names: (xs sm md))
38
+ * md
39
+ */
40
+ @function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
41
+ $n: index($breakpoint-names, $name);
42
+ @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
43
+ }
44
+
45
+ /**
46
+ * Media that spans multiple breakpoint widths.
47
+ * Makes the @content apply between the min and max breakpoints.
48
+ */
49
+ @mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
50
+ @include media-breakpoint-up($lower, $breakpoints) {
51
+ @include media-breakpoint-down($upper, $breakpoints) {
52
+ @content;
53
+ }
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Media of at most the maximum breakpoint width. No query for the largest breakpoint.
59
+ * Makes the @content apply to the given breakpoint and narrower.
60
+ */
61
+ @mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
62
+ $max: breakpoint-max($name, $breakpoints);
63
+ @if $max {
64
+ @media (max-width: $max) {
65
+ @content;
66
+ }
67
+ } @else {
68
+ @content;
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Media between the breakpoint's minimum and maximum widths.
74
+ * No minimum for the smallest breakpoint, and no maximum for the largest one.
75
+ * Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
76
+ */
77
+ @mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
78
+ @include media-breakpoint-up($name, $breakpoints) {
79
+ @include media-breakpoint-down($name, $breakpoints) {
80
+ @content;
81
+ }
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
87
+ * Makes the @content apply to the given breakpoint and wider.
88
+ */
89
+ @mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
90
+ $min: breakpoint-min($name, $breakpoints);
91
+ @if $min {
92
+ @media (min-width: $min) {
93
+ @content;
94
+ }
95
+ } @else {
96
+ @content;
97
+ }
98
+ }
@@ -0,0 +1,7 @@
1
+ @mixin clearfix() {
2
+ &::after {
3
+ clear: both;
4
+ content: '';
5
+ display: table;
6
+ }
7
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Used to generate the correct number of grid classes given any value of `$grid-columns`.
3
+ */
4
+ @mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
5
+
6
+ // Common properties for all breakpoints.
7
+ %grid-column {
8
+ // Prevent columns from collapsing when empty
9
+ min-height: 1px;
10
+ // Inner gutter via padding
11
+ padding-left: ($gutter / 2);
12
+ padding-right: ($gutter / 2);
13
+
14
+ position: relative;
15
+ }
16
+
17
+ @each $breakpoint in map-keys($breakpoints) {
18
+ @for $i from 1 through $columns {
19
+ .col-#{$breakpoint}-#{$i} {
20
+ @extend %grid-column;
21
+ }
22
+ }
23
+
24
+ @include media-breakpoint-up($breakpoint) {
25
+
26
+ // Work around cross-media @extend (https://github.com/sass/sass/issues/1050).
27
+ %grid-column-float-#{$breakpoint} {
28
+ float: left;
29
+ }
30
+
31
+ @for $i from 1 through $columns {
32
+ .col-#{$breakpoint}-#{$i} {
33
+ @if not $enable-flex {
34
+ @extend %grid-column-float-#{$breakpoint};
35
+ }
36
+
37
+ @include make-col-span($i, $columns);
38
+ }
39
+ }
40
+
41
+ @each $modifier in (pull, push, offset) {
42
+ @for $i from 0 through $columns {
43
+ .col-#{$breakpoint}-#{$modifier}-#{$i} {
44
+ @include make-col-modifier($modifier, $i, $columns)
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Generate semantic grid columns with these mixins.
3
+ */
4
+ @mixin make-container($gutter: $grid-gutter-width) {
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+ padding-left: ($gutter / 2);
8
+ padding-right: ($gutter / 2);
9
+ @if not $enable-flex {
10
+ @include clearfix();
11
+ }
12
+ }
13
+
14
+ /**
15
+ * For each breakpoint, define the maximum width of the container in a media query.
16
+ */
17
+ @mixin make-container-max-widths($max-widths: $container-max-widths) {
18
+ @each $breakpoint, $container-max-width in $max-widths {
19
+ @include media-breakpoint-up($breakpoint) {
20
+ max-width: $container-max-width;
21
+ }
22
+ }
23
+ }
24
+
25
+ @mixin make-row($gutter: $grid-gutter-width) {
26
+ @if $enable-flex {
27
+ display: flex;
28
+ flex-wrap: wrap;
29
+ } @else {
30
+ @include clearfix();
31
+ }
32
+ margin-left: ($gutter / -2);
33
+ margin-right: ($gutter / -2);
34
+ }
35
+
36
+ @mixin make-col($gutter: $grid-gutter-width) {
37
+ @if not $enable-flex {
38
+ float: left;
39
+ }
40
+ min-height: 1px;
41
+ padding-left: ($gutter / 2);
42
+ padding-right: ($gutter / 2);
43
+ position: relative;
44
+ }
45
+
46
+ @mixin make-col-span($size, $columns: $grid-columns) {
47
+ @if $enable-flex {
48
+ flex: 0 0 percentage($size / $columns);
49
+ } @else {
50
+ width: percentage($size / $columns);
51
+ }
52
+ }
53
+
54
+ @mixin make-col-offset($size, $columns: $grid-columns) {
55
+ margin-left: percentage($size / $columns);
56
+ }
57
+
58
+ @mixin make-col-push($size, $columns: $grid-columns) {
59
+ left: if($size > 0, percentage($size / $columns), auto);
60
+ }
61
+
62
+ @mixin make-col-pull($size, $columns: $grid-columns) {
63
+ right: if($size > 0, percentage($size / $columns), auto);
64
+ }
65
+
66
+ @mixin make-col-modifier($type, $size, $columns) {
67
+
68
+ // Work around the lack of dynamic mixin @include support (https://github.com/sass/sass/issues/626).
69
+ @if $type == push {
70
+ @include make-col-push($size, $columns);
71
+ } @else if $type == pull {
72
+ @include make-col-pull($size, $columns);
73
+ } @else if $type == offset {
74
+ @include make-col-offset($size, $columns);
75
+ }
76
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Grid structure options.
3
+ */
4
+ $enable-flex: false !default;
5
+ $enable-grid-classes: true !default;
6
+
7
+ /**
8
+ * Grid configuration.
9
+ */
10
+ $grid-columns: 12 !default;
11
+ $grid-gutter-width: 1.875rem !default; // 30px
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apollo-grid
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.alpha.3
5
+ platform: ruby
6
+ authors:
7
+ - Nicolas Cava
8
+ - Julien Rodrigues
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-02-26 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ''
15
+ email: n.cava@mapleinside.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/Col/index.js
21
+ - lib/Container/index.js
22
+ - lib/Row/index.js
23
+ - lib/components/Col/index.js
24
+ - lib/components/Container/index.js
25
+ - lib/components/Row/index.js
26
+ - lib/style.css
27
+ - lib/style.scss
28
+ - lib/styles/grid.scss
29
+ - lib/styles/mixins/breakpoints.scss
30
+ - lib/styles/mixins/clearfix.scss
31
+ - lib/styles/mixins/grid-framework.scss
32
+ - lib/styles/mixins/grid.scss
33
+ - lib/styles/variables.scss
34
+ homepage: https://mapleinside.github.io/apollo-grid
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">"
50
+ - !ruby/object:Gem::Version
51
+ version: 1.3.1
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.6.0
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Apollo Grid
58
+ test_files: []