Sha256: 4c7e91d52f2fec4e7a012b848ebcff7c9e43cced0a105eb057e8a5025a5701cc
Contents?: true
Size: 1008 Bytes
Versions: 17
Compression:
Stored size: 1008 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::App::Elements::Button::SIZE_ALIASES.keys) && !kwargs.key?(:resize) @size, @resize = Coco::App::Elements::Button::SIZE_ALIASES.fetch(@size) end Coco::App::Elements::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
17 entries across 17 versions & 1 rubygems