solrengine-ui 0.4.0 → 0.5.0
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 +4 -4
- data/app/components/solrengine/ui/nft_grid_component.html.erb +30 -0
- data/app/components/solrengine/ui/nft_grid_component.rb +20 -0
- data/lib/solrengine/ui/version.rb +1 -1
- data/previews/solrengine/ui/nft_grid_component_preview.rb +28 -0
- data/previews/solrengine/ui/theme_toggle_component_preview.rb +1 -3
- data/previews/solrengine/ui/token_icon_component_preview.rb +13 -3
- data/previews/solrengine/ui/wallet_button_component_preview.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87dcbf207e806153517605b53fea796ef2e3eb0c92b4ad4ff81f0d2ef7428494
|
|
4
|
+
data.tar.gz: d6589093b13502b903e969e277a52f6f43fe0a933e9c2a01e9b89b1b1a70eeb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92c68645a282489499f22b77ab325c9c723754d48c7768efffca5469b98ad98116431e532df8e29ff32530ab262b4e81978605ee58e23d97ebca5fedbbb34ca6
|
|
7
|
+
data.tar.gz: d147705dd7fb10a53ba958d9d9f2420a5abb396c954907934e5445d5d6c097734ee722395bc061ef75250272e11ae157d071e50ed200b3e1c11b820fa76ffce3
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% if empty? %>
|
|
2
|
+
<div class="text-center py-10 text-sm text-gray-500 dark:text-gray-400">
|
|
3
|
+
<%= empty_message %>
|
|
4
|
+
</div>
|
|
5
|
+
<% else %>
|
|
6
|
+
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4">
|
|
7
|
+
<% nfts.each do |nft| %>
|
|
8
|
+
<div class="rounded-xl overflow-hidden border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900">
|
|
9
|
+
<div class="aspect-square bg-gray-100 dark:bg-gray-800 flex items-center justify-center overflow-hidden">
|
|
10
|
+
<% if nft[:image].present? %>
|
|
11
|
+
<img src="<%= nft[:image] %>" alt="<%= nft[:name] %>" loading="lazy" class="w-full h-full object-cover">
|
|
12
|
+
<% else %>
|
|
13
|
+
<span class="text-2xl text-gray-400 dark:text-gray-600">🖼</span>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="px-3 py-2">
|
|
17
|
+
<p class="text-sm font-medium text-gray-900 dark:text-white truncate" title="<%= nft[:name] %>"><%= nft[:name] %></p>
|
|
18
|
+
<div class="flex items-center gap-1.5 mt-0.5">
|
|
19
|
+
<% if nft[:collection].present? %>
|
|
20
|
+
<p class="text-xs text-gray-500 dark:text-gray-400 truncate" title="<%= nft[:collection] %>"><%= nft[:collection] %></p>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% if nft[:compressed] %>
|
|
23
|
+
<span class="text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300">cNFT</span>
|
|
24
|
+
<% end %>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<% end %>
|
|
29
|
+
</div>
|
|
30
|
+
<% end %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class NftGridComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :nfts, :empty_message
|
|
7
|
+
|
|
8
|
+
# nfts: array of { id:, name:, image:, collection:, compressed: }
|
|
9
|
+
# (the shape returned by Solrengine::Tokens::Portfolio#nfts)
|
|
10
|
+
def initialize(nfts:, empty_message: "No NFTs in this wallet yet")
|
|
11
|
+
@nfts = nfts || []
|
|
12
|
+
@empty_message = empty_message
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def empty?
|
|
16
|
+
nfts.empty?
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class NftGridComponentPreview < Lookbook::Preview
|
|
6
|
+
# @label Grid with NFTs
|
|
7
|
+
def default
|
|
8
|
+
render Solrengine::Ui::NftGridComponent.new(nfts: sample_nfts)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# @label Empty wallet
|
|
12
|
+
def empty
|
|
13
|
+
render Solrengine::Ui::NftGridComponent.new(nfts: [])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def sample_nfts
|
|
19
|
+
[
|
|
20
|
+
{ id: "1", name: "Mad Lad #1234", image: "https://placehold.co/400x400/9945FF/fff?text=NFT+1", collection: "Mad Lads", compressed: false },
|
|
21
|
+
{ id: "2", name: "SuperteamTH Genesis", image: "https://placehold.co/400x400/00ff88/000?text=NFT+2", collection: "SuperteamTH", compressed: false },
|
|
22
|
+
{ id: "3", name: "Compressed Drop #42", image: "https://placehold.co/400x400/1a1a2e/fff?text=cNFT", collection: "Workshop Mints", compressed: true },
|
|
23
|
+
{ id: "4", name: "No Image NFT", image: nil, collection: nil, compressed: false }
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -10,9 +10,7 @@ module Solrengine
|
|
|
10
10
|
|
|
11
11
|
# @label In a flex container
|
|
12
12
|
def in_flex_container
|
|
13
|
-
|
|
14
|
-
template: "solrengine/ui/theme_toggle_component_preview/in_flex_container"
|
|
15
|
-
)
|
|
13
|
+
render Solrengine::Ui::ThemeToggleComponent.new
|
|
16
14
|
end
|
|
17
15
|
end
|
|
18
16
|
end
|
|
@@ -14,8 +14,18 @@ class Solrengine::Ui::TokenIconComponentPreview < Lookbook::Preview
|
|
|
14
14
|
render(Solrengine::Ui::TokenIconComponent.new(symbol: "BONK"))
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# @label
|
|
18
|
-
def
|
|
19
|
-
|
|
17
|
+
# @label Small
|
|
18
|
+
def small
|
|
19
|
+
render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :sm))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @label Medium
|
|
23
|
+
def medium
|
|
24
|
+
render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :md))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @label Large
|
|
28
|
+
def large
|
|
29
|
+
render(Solrengine::Ui::TokenIconComponent.new(symbol: "SOL", size: :lg))
|
|
20
30
|
end
|
|
21
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solrengine-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jose Ferrer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: view_component
|
|
@@ -87,6 +87,8 @@ files:
|
|
|
87
87
|
- app/components/solrengine/ui/modal_component.rb
|
|
88
88
|
- app/components/solrengine/ui/network_badge_component.html.erb
|
|
89
89
|
- app/components/solrengine/ui/network_badge_component.rb
|
|
90
|
+
- app/components/solrengine/ui/nft_grid_component.html.erb
|
|
91
|
+
- app/components/solrengine/ui/nft_grid_component.rb
|
|
90
92
|
- app/components/solrengine/ui/notification_component.html.erb
|
|
91
93
|
- app/components/solrengine/ui/notification_component.rb
|
|
92
94
|
- app/components/solrengine/ui/send_transaction_form_component.html.erb
|
|
@@ -121,6 +123,7 @@ files:
|
|
|
121
123
|
- previews/solrengine/ui/footer_component_preview.rb
|
|
122
124
|
- previews/solrengine/ui/modal_component_preview.rb
|
|
123
125
|
- previews/solrengine/ui/network_badge_component_preview.rb
|
|
126
|
+
- previews/solrengine/ui/nft_grid_component_preview.rb
|
|
124
127
|
- previews/solrengine/ui/notification_component_preview.rb
|
|
125
128
|
- previews/solrengine/ui/send_transaction_form_component_preview.rb
|
|
126
129
|
- previews/solrengine/ui/theme_toggle_component_preview.rb
|