clearwater-virtual_list 0.1.1 → 0.1.2

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: 22a47bedba29fe5d2d72109c855c6ec1cd72853b3c1fcc90a769bb886d8113f5
4
- data.tar.gz: fce48744632137a2f4af3b35614f7f53c609082f5de96964e7eff2f92e27d466
3
+ metadata.gz: 68d27d1bbb1ff51020345231f89f4641283907e3048ada732e782e463852e9dd
4
+ data.tar.gz: 2c52e47b00fb5f6e7d27436d55a26a782c25d06f4f8210f46faf4b9ba8e2c317
5
5
  SHA512:
6
- metadata.gz: d09f627c325fbe2967bc5cc49dca340d50cf488844735ea8f4f85ade2f0421948413b4786b23d4e56e374249d449547ea31311c0a2df47d730d0eef2f1f7699e
7
- data.tar.gz: 72696cc87832ffb93a3d28be7671ee4a32386bad9df6172619503efc762f4ae123d809f7932d0494651378d553a9217c823012c9ca7e4bf5b24bba3c144decf5
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(
@@ -1,5 +1,5 @@
1
1
  module Clearwater
2
2
  module VirtualList
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -57,7 +57,7 @@ module Clearwater
57
57
  render_content element
58
58
  end
59
59
 
60
- def destroy
60
+ def unmount
61
61
  Bowser.window.off :scroll, &onscroll
62
62
  Bowser.window.off :resize, &onresize
63
63
  end
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.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-02-26 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler