Sha256: 612055129cbfc10df209075392f6096f602e6c0f8f6a09fcb6849e2070d767a1
Contents?: true
Size: 785 Bytes
Versions: 11
Compression:
Stored size: 785 Bytes
Contents
module Lookbook class TextButton::Component < Lookbook::BaseComponent renders_many :icons, Lookbook::Icon::Component ICON_SIZES = { xs: 3, sm: 3.5, md: 4, lg: 6 } attr_reader :icon, :tooltip, :disabled, :size, :href def initialize(id: nil, icon: nil, tooltip: nil, disabled: false, size: :md, href: nil, **html_attrs) @id = id @icon = icon @tooltip = tooltip @disabled = disabled @size = size @href = href super(**html_attrs) end def id @id ||= Utils.temp_id(prefix: "button") end def icon_size ICON_SIZES[size] end def tag_name href.present? ? :a : :button end protected def alpine_component "buttonComponent" end end end
Version data entries
11 entries across 11 versions & 1 rubygems