Sha256: 2e658c2be58bab4a4dbecfc15607978f0ec260a417f95c6e871c29665ecf532b
Contents?: true
Size: 773 Bytes
Versions: 8
Compression:
Stored size: 773 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(**) @sections = { start: nil, end: nil } super end def start_section @sections[:start] end def end_section @sections[:end] end end end
Version data entries
8 entries across 8 versions & 1 rubygems