Skip to content

Commit 1492473

Browse files
committed
moved stock ticker cancel button
1 parent dca908e commit 1492473

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ruby/examples/misc/stock-tickers/app/hyperstack/components/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class App < HyperComponent
55
@symbols.sort.each do |symbol|
66
LI(key: symbol) do
77
DisplayTicker(symbol: symbol, key: symbol)
8-
BUTTON { 'cancel' }.on(:click) { mutate @symbols.delete(symbol) }
8+
.on(:cancel) { mutate @symbols.delete(symbol) }
99
end
1010
end
1111
end
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
class DisplayTicker < HyperComponent
22
param :symbol
3+
param :on_cancel, type: Proc
34
before_mount { @ticker = StockTicker.new(params.symbol, 10.seconds) }
45
render(DIV) do
5-
"#{params.symbol.upcase} current price: #{@ticker.price}"
6+
SPAN { "#{params.symbol.upcase} current price: #{@ticker.price}" }
7+
BUTTON { 'cancel' }.on(:click) { params.on_cancel }
68
end
79
end

0 commit comments

Comments
 (0)