optics_view_components 0.1.4 → 0.1.6

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: ffe52b98369672a1d6eed1b8243910a5e407ac98deb91b0d85d01838b2d008ba
4
- data.tar.gz: b200545febaac7348d8c12489c7d5e5baad3781bd4af61f2ba644f50a640940e
3
+ metadata.gz: 5089194dafd053f1b21e399d01fa5c9c3bf8f4851d8232065ba1ba0e13d4b8ee
4
+ data.tar.gz: 2db292342076af2ca06cccf3eb3266ed149f01f15e56b79cf5986937e0d42462
5
5
  SHA512:
6
- metadata.gz: 6a821b4466922983f0dcbd589beac2e16fd6134440f1b8d3746198c3ef3852e8bdf088a86ea7d612a0a35d3218d80aef3d9e086df0d0a7e6d4d4137819dd6aa0
7
- data.tar.gz: 9c42b42d99b2c36586d27ffc3c20dc56249b388360cb804ee13ae359abb81b3712acc879621ebeef99c39536e42458400ee279ce8b00e4715c982b4da8c4cc6f
6
+ metadata.gz: a7234b11befc27ab837247c1ab7738b32273493d1eb9c75b5955cbb8fe843f8d69e07afb9f966255cba89fc832455b091fdbb6bef38a2e50a997e11cfc0a403d
7
+ data.tar.gz: 5aa83b5e3465b60b0d5ceba74a576bb4d223947bbf0a1df0209761e09d98a55947bd6a9a8fe51957a26f097ee5b0fccf7a3d741e430648f30828bd2ad381b30c
@@ -21,7 +21,8 @@ module Optics
21
21
  class: classes,
22
22
  'aria-label': title,
23
23
  title:,
24
- data:
24
+ data:,
25
+ **@attributes.except(:class)
25
26
  ) do
26
27
  name
27
28
  end
@@ -30,6 +31,7 @@ module Optics
30
31
  def classes
31
32
  class_names(
32
33
  'material-symbols-outlined',
34
+ @attributes[:class],
33
35
  size_class,
34
36
  weight_class,
35
37
  emphasis_class,
@@ -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.4'
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.4
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-07 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