Skip to content

Commit 28e38c1

Browse files
changed example
1 parent 2ebbb55 commit 28e38c1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/dsl-client/hyper-component.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,22 +316,22 @@ Along with params components may be passed a block which is used to build the co
316316
The instance method `children` returns an enumerable that is used to access the unrendered children of a component.
317317

318318
```ruby
319-
class IndentEachLine < Hyperstack::Component
320-
param by: 20, type: Integer
321-
319+
class Indenter < Hyperstack::Component
322320
render(DIV) do
323-
children.each_with_index do |child, i|
324-
child.render(style: {"margin-left" => params.by*i})
321+
IndentEachLine(by: 100) do # see IndentEachLine below
322+
DIV {"Line 1"}
323+
DIV {"Line 2"}
324+
DIV {"Line 3"}
325325
end
326326
end
327327
end
328328

329-
class Indenter < Hyperstack::Component
329+
class IndentEachLine < Hyperstack::Component
330+
param by: 20, type: Integer
331+
330332
render(DIV) do
331-
IndentEachLine(by: 100) do
332-
DIV {"Line 1"}
333-
DIV {"Line 2"}
334-
DIV {"Line 3"}
333+
children.each_with_index do |child, i|
334+
child.render(style: {"margin-left" => params.by*i})
335335
end
336336
end
337337
end

0 commit comments

Comments
 (0)