clearwater-virtual_list 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/clearwater/virtual_list/version.rb +1 -1
- data/opal/clearwater/virtual_list.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: 68d27d1bbb1ff51020345231f89f4641283907e3048ada732e782e463852e9dd
|
4
|
+
data.tar.gz: 2c52e47b00fb5f6e7d27436d55a26a782c25d06f4f8210f46faf4b9ba8e2c317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19bceb7ec575d27215ce8ad53f218b5955d3998fbc69d538eed64077a7f11af3f32b874483034e6d3b3790f031751133a7a8b25c057f3da61605f7fc5b30c8b6
|
7
|
+
data.tar.gz: dd4098f5d5e97004c2fc3159bdb1e5cf21cc2d701909b59a8f5c1d6fdfa13c1ef88dbb871240601c3fc7668def0f506397c28023d3ac3346c12806dd6b9381c7
|
data/README.md
CHANGED
@@ -23,8 +23,32 @@ Or install it yourself as:
|
|
23
23
|
Inside your Clearwater app:
|
24
24
|
|
25
25
|
```ruby
|
26
|
+
require 'clearwater/component'
|
26
27
|
require 'clearwater/virtual_list'
|
27
28
|
|
29
|
+
class MyList
|
30
|
+
include Clearwater::Component
|
31
|
+
|
32
|
+
def initialize(items: [], list_style:, item_style:)
|
33
|
+
# VirtualList will give you the items to render within the viewport
|
34
|
+
@items = items
|
35
|
+
|
36
|
+
# Make sure you set your list container's style property to this value
|
37
|
+
@list_style = list_style
|
38
|
+
|
39
|
+
# Make sure the list items' styles are set with this
|
40
|
+
@item_style = item_style
|
41
|
+
end
|
42
|
+
|
43
|
+
def render
|
44
|
+
ul({ style: @list_style }, @items.map { |item|
|
45
|
+
li({ style: @item_style }, [
|
46
|
+
# ...
|
47
|
+
])
|
48
|
+
})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
28
52
|
# Define the virtual list component in terms of your regular list component
|
29
53
|
MyVirtualList = Clearwater::VirtualList.create do |items:, list_style:, item_style:|
|
30
54
|
MyList.new(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearwater-virtual_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Gaskins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|