primer_view_components 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc437081b46691abf1c8946de200196e1ceb5b535aa47e7925c03495ae73f3d
4
- data.tar.gz: fbbeda9a022db4a9799daf8c0b509481f0ef57c122ac50c51c487a50445a9d65
3
+ metadata.gz: be0c09210143e8465e55e213978714a4b27a19d2ddb690e3dfc378e4e3123e3b
4
+ data.tar.gz: '0862e8437eff534e74fc1275f99c53f0445285de2cd409cd9ea4f20e54349ec0'
5
5
  SHA512:
6
- metadata.gz: 648cb2d8145c520fdf7f3da6af9b4047954343d7311caa7b5579adab5dc67b9ca697815e0f0b9c0f9f8d702edd82f9948fbf14ae3ee9397175aa0f3a8d12ec0e
7
- data.tar.gz: 90e55106cc699d69f4473cb2844687b4b77597b85c5038be41acf3f56575f0c7e8dbce27ec7fe407b80b91ee12345bc272d2442b84af8ebf837be4451f0983b8
6
+ metadata.gz: 2b0511a3995c27d1d0b7bb8979c53a1b72e6ae1ea73bff636278ccb590a386d96e46393d871e3993c613604c6e10dbc386cc1a1de6f6ebeebccbf3f973965326
7
+ data.tar.gz: 20ba7273f5b2d655c5ebb6c283ea2d36e34e2417fd51f6bd4698dc7187985baa1944b4f548a3756622f7c697742f3388bec5dd3f3d00d1e7a12936e011dea440
@@ -1,5 +1,14 @@
1
1
  # main
2
2
 
3
+ # 0.0.4
4
+
5
+ * Added support for mx: and my: :auto.
6
+
7
+ *Christian Giordano*
8
+
9
+ * Added support for custom layout sizes.
10
+
11
+ *Manuel Puyol*
3
12
  # 0.0.3
4
13
 
5
14
  * Add support for responsive `float` style argument.
@@ -1,16 +1,16 @@
1
1
  <%= render(Primer::FlexComponent.new(**@kwargs)) do %>
2
2
  <% if @side == :left %>
3
- <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, 3] : 3), mb: (@responsive ? [4, nil, 0] : nil)) do %>
3
+ <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, @sidebar_col] : @sidebar_col), mb: (@responsive ? [4, nil, 0] : nil)) do %>
4
4
  <%= sidebar %>
5
5
  <% end %>
6
6
  <% end %>
7
7
 
8
- <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, 9] : 9), mb: (@responsive ? [4, nil, 0] : nil)) do %>
8
+ <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, @main_col] : @main_col), mb: (@responsive ? [4, nil, 0] : nil)) do %>
9
9
  <%= main %>
10
10
  <% end %>
11
11
 
12
12
  <% if @side == :right %>
13
- <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, 3] : 3)) do %>
13
+ <%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, @sidebar_col] : @sidebar_col)) do %>
14
14
  <%= sidebar %>
15
15
  <% end %>
16
16
  <% end %>
@@ -5,17 +5,24 @@ module Primer
5
5
  with_content_areas :main, :sidebar
6
6
 
7
7
  DEFAULT_SIDE = :right
8
- ALLOWED_SIDES = [DEFAULT_SIDE, :left]
8
+ ALLOWED_SIDES = [DEFAULT_SIDE, :left].freeze
9
9
 
10
- def initialize(responsive: false, side: DEFAULT_SIDE, **kwargs)
10
+ MAX_COL = 12
11
+ DEFAULT_SIDEBAR_COL = 3
12
+ ALLOWED_SIDEBAR_COLS = (1..(MAX_COL - 1)).to_a.freeze
13
+
14
+ def initialize(responsive: false, side: DEFAULT_SIDE, sidebar_col: DEFAULT_SIDEBAR_COL, **kwargs)
11
15
  @kwargs = kwargs
12
- @side = fetch_or_fallback(ALLOWED_SIDES, side, DEFAULT_SIDE)
16
+ @side = fetch_or_fallback(ALLOWED_SIDES, side.to_sym, DEFAULT_SIDE)
13
17
  @responsive = responsive
14
18
  @kwargs[:classes] = class_names(
15
19
  "gutter-condensed gutter-lg",
16
20
  @kwargs[:classes]
17
21
  )
18
22
  @kwargs[:direction] = responsive ? [:column, nil, :row] : nil
23
+
24
+ @sidebar_col = fetch_or_fallback(ALLOWED_SIDEBAR_COLS, sidebar_col, DEFAULT_SIDEBAR_COL)
25
+ @main_col = MAX_COL - @sidebar_col
19
26
  end
20
27
  end
21
28
  end
@@ -161,9 +161,9 @@ module Primer
161
161
 
162
162
  if SPACING_KEYS.include?(key)
163
163
  if MARGIN_DIRECTION_KEYS.include?(key)
164
- raise ArgumentError, "value must be between -6 and 6" if (val < -6 || val > 6)
165
- else
166
- raise ArgumentError, "value must be between 0 and 6" if (val < 0 || val > 6)
164
+ raise ArgumentError, "value of #{key} must be between -6 and 6" if (val < -6 || val > 6)
165
+ elsif !((key == :mx || key == :my) && val == :auto)
166
+ raise ArgumentError, "value of #{key} must be between 0 and 6" if (val < 0 || val > 6)
167
167
  end
168
168
  end
169
169
 
@@ -23,7 +23,7 @@ module Primer
23
23
  if allowed_values.include?(given_value)
24
24
  given_value
25
25
  else
26
- if fallback_raises && ENV["RAILS_ENV"] != "production"
26
+ if fallback_raises && ENV["RAILS_ENV"] != "production" && ENV["STORYBOOK"] != "true"
27
27
  raise InvalidValueError, <<~MSG
28
28
  fetch_or_fallback was called with an invalid value.
29
29
 
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 3
8
+ PATCH = 4
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails