Sha256: b9ad17573cc3b5d9b4e414d07dd167e6a797205271a6937a8775a66b91d57041
Contents?: true
Size: 789 Bytes
Versions: 17
Compression:
Stored size: 789 Bytes
Contents
module Coco class Toolbar < Coco::Component 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::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
Version data entries
17 entries across 17 versions & 1 rubygems