optics_view_components 0.1.6 → 0.1.7

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: 5089194dafd053f1b21e399d01fa5c9c3bf8f4851d8232065ba1ba0e13d4b8ee
4
- data.tar.gz: 2db292342076af2ca06cccf3eb3266ed149f01f15e56b79cf5986937e0d42462
3
+ metadata.gz: 5194f25da267f185510137dd9cb5cda150d6da2ea4bea6dcdbe2353360b460ba
4
+ data.tar.gz: c856c408ca950243a0b00bf080c93c8a1d182f7a1bcb87df35084522c82c78d4
5
5
  SHA512:
6
- metadata.gz: a7234b11befc27ab837247c1ab7738b32273493d1eb9c75b5955cbb8fe843f8d69e07afb9f966255cba89fc832455b091fdbb6bef38a2e50a997e11cfc0a403d
7
- data.tar.gz: 5aa83b5e3465b60b0d5ceba74a576bb4d223947bbf0a1df0209761e09d98a55947bd6a9a8fe51957a26f097ee5b0fccf7a3d741e430648f30828bd2ad381b30c
6
+ metadata.gz: 87d76b46feb1fed4772bd7e6ca8efd36e1c3bb38cae8fb94325f676dfef1e38bb8b6ec9a897010d72dd7d154dd6638ce961e2a6245c45be0a170a8c036276fb9
7
+ data.tar.gz: fafd24dd4f8738e53b012a0a82ce10b4a2c6e35c7ccbaa872316055641260d2c62c09cfbc8ce8e87c63578ea37566c23544fd4d06d57cf54c561e866958fa148
@@ -3,9 +3,12 @@
3
3
  module Optics
4
4
  module Sidebar
5
5
  class Component < ApplicationViewComponent
6
+ VARIANTS = %w[drawer compact rail]
7
+
6
8
  renders_one :brand, 'Brand'
7
- renders_many :buttons, Optics::Button::Component
9
+ renders_many :sidebar_contents, 'SidebarContent'
8
10
 
11
+ accepts :responsive, default: false
9
12
  accepts :variant, default: 'drawer'
10
13
 
11
14
  def call
@@ -15,16 +18,9 @@ module Optics
15
18
  ) do
16
19
  capture do
17
20
  concat brand
18
- concat(
19
- content_tag(
20
- :div,
21
- class: 'sidebar__content sidebar__content--center'
22
- ) do
23
- buttons.each do |button|
24
- concat button
25
- end
21
+ sidebar_contents.each do |content|
22
+ concat content
26
23
  end
27
- )
28
24
  end
29
25
  end
30
26
  end
@@ -33,7 +29,8 @@ module Optics
33
29
  class_names(
34
30
  'sidebar',
35
31
  variant_class,
36
- @attributes[:class]
32
+ @attributes[:class],
33
+ 'sidebar--responsive': responsive
37
34
  ).join(' ')
38
35
  end
39
36
 
@@ -52,9 +49,37 @@ module Optics
52
49
  end
53
50
  end
54
51
 
55
- class LinksComponent < ApplicationViewComponent
56
- VARIANTS = %w[drawer compact rail]
52
+ class SidebarContent < ApplicationViewComponent
53
+ renders_many :buttons, Optics::Button::Component
54
+
55
+ accepts :position, default: 'center'
56
+
57
+ def call
58
+ concat(
59
+ content_tag(
60
+ :div,
61
+ class: classes
62
+ ) do
63
+ buttons.each do |button|
64
+ concat button
65
+ end
66
+ end
67
+ )
68
+ end
57
69
 
70
+ def classes
71
+ class_names(
72
+ 'sidebar__content',
73
+ position_class,
74
+ ).join(' ')
75
+ end
76
+
77
+ def position_class
78
+ "sidebar__content--#{position}"
79
+ end
80
+ end
81
+
82
+ class LinksComponent < ApplicationViewComponent
58
83
  accepts :image_source
59
84
  accepts :url
60
85
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Optics
4
4
  module ViewComponents
5
- VERSION = '0.1.6'
5
+ VERSION = '0.1.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optics_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reed Law
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-18 00:00:00.000000000 Z
11
+ date: 2023-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: view_component