Sha256: de19b13deb51a19ef5656cc3e8f629758124bb9ce04f3139a456f1e4689f7624
Contents?: true
Size: 1.82 KB
Versions: 5
Compression:
Stored size: 1.82 KB
Contents
require_relative 'mixins/common' require_relative 'mixins/attaches' module Voom module Presenters module DSL module Components class Dialog < Base include Mixins::Common include Mixins::Attaches attr_accessor :width, :height, :buttons, :components, :shows_errors def initialize(**attribs_, &block) super(type: :dialog, **attribs_, &block) @width = attribs.delete(:width) @height = attribs.delete(:height) @shows_errors = attribs.delete(:shows_errors){true} @buttons = [] @components=[] expand! end def title(*title, **options, &block) return @title if locked? @title = Components::Typography.new(parent: self, type: :title, text: title, context: context, **options, &block) end def heading(*text, **options, &block) components << Components::Typography.new(parent: self, type: :heading, text: text, context: context, **options, &block) end def body(*text, **options, &block) components << Components::Typography.new(parent: self, type: :body, text: text, context: context, **options, &block) end def button(text=nil, **attribs, &block) @buttons << Button.new(parent: self, text: text, context: context, **attribs, &block) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems