Sha256: f9c0c0ae65709864db63fae4ab5753730cdaba2fc1274cecd42868f63aac0fed
Contents?: true
Size: 996 Bytes
Versions: 41
Compression:
Stored size: 996 Bytes
Contents
module Coco module App module Elements class Toolbar < Coco::Component include Coco::AppHelper renders_many :sections, ->(*args, align: nil, **kwargs, &block) do alignment = if align.nil? @sections[:start].nil? ? :start : :end else align end.to_sym unless @sections[alignment].nil? raise "Toolbar already has a `#{alignment}` section defined" end component = Coco::App::Elements::ButtonGroup.new(**kwargs, theme: :toolbar, collapsible: true) @sections[alignment] = view_context.render(component, &block) end def initialize(**kwargs) @sections = { start: nil, end: nil } super(**kwargs) end def start_section @sections[:start] end def end_section @sections[:end] end end end end end
Version data entries
41 entries across 41 versions & 1 rubygems