Class: BetterUi::LinkComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/better_ui/link_component.rb

Constant Summary collapse

SIZES =
{
  xs: "text-xs",
  sm: "text-sm",
  md: "text-base",
  lg: "text-lg",
  xl: "text-xl"
}.freeze
STYLES =
i[default underline ghost].freeze

Constants inherited from ApplicationComponent

ApplicationComponent::SHADOWS, ApplicationComponent::VARIANTS, ApplicationComponent::VARIANT_BODY_DIVIDE, ApplicationComponent::VARIANT_DIVIDE, ApplicationComponent::VARIANT_HEADER_BG, ApplicationComponent::VARIANT_HEADER_TEXT, ApplicationComponent::VARIANT_HIGHLIGHTED, ApplicationComponent::VARIANT_HOVERABLE, ApplicationComponent::VARIANT_RING, ApplicationComponent::VARIANT_SORT_ICON, ApplicationComponent::VARIANT_STRIPED

Instance Method Summary collapse

Constructor Details

#initialize(href:, variant: :primary, style: :default, size: :md, target: nil, rel: nil, disabled: false, container_classes: nil, **options) ⇒ LinkComponent

Returns a new instance of LinkComponent.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/components/better_ui/link_component.rb', line 18

def initialize(
  href:,
  variant: :primary,
  style: :default,
  size: :md,
  target: nil,
  rel: nil,
  disabled: false,
  container_classes: nil,
  **options
)
  @href = href
  @variant = validate_variant(variant)
  @style = validate_style(style)
  @size = validate_size(size)
  @target = target
  @rel = compute_rel(target, rel)
  @disabled = disabled
  @container_classes = container_classes
  @options = options
end