Sha256: be55a8797b7698eb844d046f8aa39cf07f85dcc995ca51789ba2dd57e052643c

Contents?: true

Size: 1.97 KB

Versions: 35

Compression:

Stored size: 1.97 KB

Contents

<%= render component_tag(:div,
  x: {
    data: x_data("button", alpine_data),
    "@click": on_click,
    dropdown: dropdown_opts,
    bind: "root"
  },
  class: component_classes,
) do %>
  <%= coco_tag(button_tag_name,
    **button_attrs,
    class: "button-element",
    x: {
      "dropdown:trigger": (true if dropdown?),
      "@click": ("checkConfirmation" if confirm?),
      ":disabled": "disabled"
    }
  ) do %>
    <span class="button-inner">
      <% states.each do |name, props| %>
        <% if props[:icon].present? %>
          <% if states.many? %>
            <span
              class="button-icon"
              x-ref="<%= name %>Icon"
              x-show="showIcon('<%= name %>')"
              <%= "x-cloak" unless name.to_sym == :default %>>
              <%= props[:icon] %>
            </span>
          <% else %>
            <span class="button-icon" x-ref="defaultIcon">
              <%= props[:icon] %>
            </span>
          <% end %>
        <% end %>
      <% end %>
      
      <% unless icon_only? %>
        <% states.each do |name, props| %>
          <% if states.many? %>
            <span
              class="button-content"
              x-ref="<%= name %>Content"
              x-show="showContent('<%= name %>')"
              <%= "x-cloak" unless name.to_sym == :default %>>
              <%= props[:text] %>
            </span>
          <% else %>
            <span class="button-content" x-ref="defaultContent">
              <%= props[:text] %>
            </span>
          <% end %>
        <% end %>
      <% end %>

      <% if toggle? %>
        <% if toggle_direction == :horizontal %>
          <%= coco_icon(:chevron_right, class: "button-toggle") %>
        <% else %>
          <%= coco_icon(:chevron_down, class: "button-toggle") %>
        <% end %>
      <% end %>
    </span>
  <% end %>

  <% if dropdown? %>
    <div x-dropdown:content>
      <div class="button-dropdown">
        <%= dropdown %>
      </div>
    </div>
  <% end %>
<% end %>

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
coveragebook_components-0.8.9 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.8 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.7 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.6 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.5 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.4 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.3 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.2 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.1 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.0 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.0.beta.3 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.0.beta.2 app/components/coco/base/button/button.html.erb
coveragebook_components-0.8.0.beta.1 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.10 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.9 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.8 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.7 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.6 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.5 app/components/coco/base/button/button.html.erb
coveragebook_components-0.7.4 app/components/coco/base/button/button.html.erb