Sha256: 4dbf72c46eb5992f152008cdc7676695ab4f6330b44d76a628d10b4dea8658d2
Contents?: true
Size: 784 Bytes
Versions: 20
Compression:
Stored size: 784 Bytes
Contents
module Lookbook class Button::Component < Lookbook::BaseComponent renders_one :icon, Lookbook::Icon::Component renders_one :dropdown ICON_SIZES = { xs: 3, sm: 3.5, md: 4, lg: 6 } def initialize(icon: nil, tooltip: nil, disabled: false, size: :md, href: nil, **html_attrs) @icon = icon @tooltip = tooltip @disabled = disabled @size = size @href = href super(**html_attrs) end def icon_size ICON_SIZES[@size] end def padding [:xs, :sm].include?(@size) ? "p-1" : "p-2" end def tag_name @href.present? ? :a : :button end def dropdown? dropdown.present? end protected def alpine_component "buttonComponent" end end end
Version data entries
20 entries across 20 versions & 1 rubygems