Sha256: eb6507b092dd0472817fda4bc8a953ab0784490c2ac62f4de5bf7239949ade54
Contents?: true
Size: 963 Bytes
Versions: 7
Compression:
Stored size: 963 Bytes
Contents
module Coco module App module Elements class MenuButton < Coco::Component include Concerns::AcceptsOptions include Concerns::WithIcon include Concerns::WrapsComponent include Coco::AppHelper wraps_component :button do |kwargs| @size = kwargs.fetch(:size, :default)&.to_sym if @size.in?(Coco::Button::SIZE_ALIASES.keys) && !kwargs.key?(:resize) @size, @resize = Coco::Button::SIZE_ALIASES.fetch(@size) end Coco::Button.new(toggle: :vertical, fit: get_option_value(:fit) || :auto, **kwargs) end accepts_option :fit, from: [:auto, :full] renders_one :text, Coco::Content renders_one :menu, ->(**kwargs) do Coco::App::Elements::Menu.new(size: @size, resize: @resize, **kwargs) end attr_reader :size, :resize def button_text text || content end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems