bulma-phlex 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63d0fb33d15debb198d1469b5f467f8ab155836600a7eece3167f1e6301007b7
4
- data.tar.gz: c6fc149bcd52613d37c220802a213d4bc836884d5332ba4a2f6402e61b9c55fe
3
+ metadata.gz: 5caa2176372f45d0002153e7a4272e79bd3ae01eb530e58c16a29864a3e90c09
4
+ data.tar.gz: 4ed606f6cb03296a7c0c52eccbe2e31bb2c7eb1c0e2fbbaef1510f8ad8f7d48f
5
5
  SHA512:
6
- metadata.gz: 9f2df9cb18c084d02717dac31fc8eb275035ab474eb7184c61a4d6ff488dbceb27caa3ecf8bad4d00395900f5de20c8bbe014c9052a3ac16468e6be8e0f393e5
7
- data.tar.gz: a3d55de4aefceb64805920b80ac851f9adba80140006d40286fe1a6cbc42efb43dc20b2a849c3053c9e910646a819423b5282af44540af8505b2ffb53706de72
6
+ metadata.gz: 2d3173c063bb8fc27fa653b34a2f4a57d6b653c313361d1bd1661d13feb760a31e5f8a102407a4024c5e48671031ae5d1b11b6d3414d38b17a3d43d38b2c3918
7
+ data.tar.gz: 9ec45c90c5060eb1d812d939ae03687c1027ed49c3959bf3f8855216c4e331c7ebb221f4a46903022a0a0d753cebab4a9ff0465528b5dfa424ce37e9b6b7340e
data/README.md CHANGED
@@ -155,7 +155,7 @@ end
155
155
  The [NavigationBar](https://bulma.io/documentation/components/navbar/) component provides a responsive navigation header with support for branding, navigation links, and dropdown menus.
156
156
 
157
157
  ```ruby
158
- Bulma::NavigationBar() do |navbar|
158
+ Bulma::NavigationBar(classes: "is-primary") do |navbar|
159
159
  navbar.brand_item "My App", "/"
160
160
 
161
161
  navbar.left do |menu|
@@ -176,6 +176,14 @@ Bulma::NavigationBar() do |navbar|
176
176
  end
177
177
  ```
178
178
 
179
+ **Constructor Keyword Arguments:**
180
+
181
+ - `classes`: Additional classes to be added to the `nav` element, such as "is-primary" or "has-shadow".
182
+ - `container`: When true, wraps the content in a Bulma container. To set a constraint, such as "is-max-desktop", pass that string instead of true. (defaults to false)
183
+
184
+ > [!NOTE]
185
+ > Adding a container will limit the width of the Navigation Bar content according to Bulma's container rules. The background color of the navbar will still span the full width of the viewport.
186
+
179
187
  ### Pagination
180
188
 
181
189
  The [Pagination](https://bulma.io/documentation/components/pagination/) component provides navigation controls for paginated content, including previous/next links, page number links, and a summary of items being displayed.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BulmaPhlex
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -36,7 +36,9 @@ module Components
36
36
  # ```
37
37
  #
38
38
  class NavigationBar < Components::Bulma::Base
39
- def initialize
39
+ def initialize(container: false, classes: "")
40
+ @container = container
41
+ @classes = classes
40
42
  @brand = []
41
43
  @left = []
42
44
  @right = []
@@ -45,11 +47,11 @@ module Components
45
47
  def view_template(&)
46
48
  vanish(&)
47
49
 
48
- nav(class: "navbar is-light block",
50
+ nav(class: "navbar #{@classes}".rstrip,
49
51
  role: "navigation",
50
52
  aria_label: "main navigation",
51
53
  data: { controller: "bulma--navigation-bar" }) do
52
- div(class: "container") do
54
+ optional_container do
53
55
  div(class: "navbar-brand") do
54
56
  @brand.each(&:call)
55
57
 
@@ -90,6 +92,17 @@ module Components
90
92
  def right(&block)
91
93
  @right << block
92
94
  end
95
+
96
+ private
97
+
98
+ def optional_container(&)
99
+ if @container
100
+ constraint = @container if @container.is_a?(String) || @container.is_a?(Symbol)
101
+ div(class: "container #{constraint}".rstrip, &)
102
+ else
103
+ yield
104
+ end
105
+ end
93
106
  end
94
107
  end
95
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulma-phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Kummer