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 +4 -4
- data/app/components/optics/sidebar/component.rb +38 -13
- data/lib/optics/view_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5194f25da267f185510137dd9cb5cda150d6da2ea4bea6dcdbe2353360b460ba
|
4
|
+
data.tar.gz: c856c408ca950243a0b00bf080c93c8a1d182f7a1bcb87df35084522c82c78d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 :
|
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
|
-
|
19
|
-
|
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
|
56
|
-
|
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
|
|
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
|
+
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-
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: view_component
|