optics_view_components 0.1.5 → 0.1.6

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: 54fb6a68b7cdd5b3ccd449bca62f7011af24f36fc541a92d7da7d8254b26047b
4
- data.tar.gz: aa821b1b78cabd2f2f2f78aa9aecefa4b40590fe76be411cafb6ec9b5675fb8c
3
+ metadata.gz: 5089194dafd053f1b21e399d01fa5c9c3bf8f4851d8232065ba1ba0e13d4b8ee
4
+ data.tar.gz: 2db292342076af2ca06cccf3eb3266ed149f01f15e56b79cf5986937e0d42462
5
5
  SHA512:
6
- metadata.gz: 172d34c022dcd91ac936ada62fb622c3836c14d22528f98a89e8eaf25cdf5539e496523e9dcc95303abf6f8c54c4ceba3b5bd0f2a3bb30eccf1380da80c7ba10
7
- data.tar.gz: 34faf6863d961a9c7d12ad5a3ce12a49d35718a9b30abb7a912929181988777e72bf945fa97769756b614a756a555653914da72f9cd31967543b2f58d939c587
6
+ metadata.gz: a7234b11befc27ab837247c1ab7738b32273493d1eb9c75b5955cbb8fe843f8d69e07afb9f966255cba89fc832455b091fdbb6bef38a2e50a997e11cfc0a403d
7
+ data.tar.gz: 5aa83b5e3465b60b0d5ceba74a576bb4d223947bbf0a1df0209761e09d98a55947bd6a9a8fe51957a26f097ee5b0fccf7a3d741e430648f30828bd2ad381b30c
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Optics
4
+ module Sidebar
5
+ class Component < ApplicationViewComponent
6
+ renders_one :brand, 'Brand'
7
+ renders_many :buttons, Optics::Button::Component
8
+
9
+ accepts :variant, default: 'drawer'
10
+
11
+ def call
12
+ content_tag(
13
+ :nav,
14
+ class: classes
15
+ ) do
16
+ capture do
17
+ 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
26
+ end
27
+ )
28
+ end
29
+ end
30
+ end
31
+
32
+ def classes
33
+ class_names(
34
+ 'sidebar',
35
+ variant_class,
36
+ @attributes[:class]
37
+ ).join(' ')
38
+ end
39
+
40
+ def variant_class
41
+ "sidebar--#{variant}"
42
+ end
43
+
44
+ class Brand < ApplicationViewComponent
45
+ accepts :url
46
+ accepts :image_source
47
+
48
+ def call
49
+ link_to(url, class: 'sidebar__brand') do
50
+ image_tag(image_source)
51
+ end
52
+ end
53
+ end
54
+
55
+ class LinksComponent < ApplicationViewComponent
56
+ VARIANTS = %w[drawer compact rail]
57
+
58
+ accepts :image_source
59
+ accepts :url
60
+
61
+ def call
62
+ link_to(url, class: 'sidebar__brand') do
63
+ image_tag(image_source)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Optics
4
4
  module ViewComponents
5
- VERSION = '0.1.5'
5
+ VERSION = '0.1.6'
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.5
4
+ version: 0.1.6
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-06-19 00:00:00.000000000 Z
11
+ date: 2023-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: view_component
@@ -119,6 +119,7 @@ files:
119
119
  - app/components/optics/application_view_component_preview.rb
120
120
  - app/components/optics/button/component.rb
121
121
  - app/components/optics/icon/component.rb
122
+ - app/components/optics/sidebar/component.rb
122
123
  - demo/.ruby-version
123
124
  - demo/Gemfile
124
125
  - demo/Gemfile.lock