Sha256: 4dcdf4f38095e2ca2c4c27230e1e78a7c1c2c19ba3f55a5e185aa82ad6f01651
Contents?: true
Size: 981 Bytes
Versions: 7
Compression:
Stored size: 981 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::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
7 entries across 7 versions & 1 rubygems