Sha256: f49a7930b2822663d2c2c75e67d6600bb8def9110731e097b472ecf8fc656b75

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

<%
button_classes = [
  "relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full
    cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2
    focus:ring-offset-2 focus:ring-input-border-focus",
  value == true ? "bg-lookbook-input-toggle-active" : "bg-lookbook-input-toggle"
]
span_classes = [
  "pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow ring-0 transition ease-in-out duration-200",
  value == true ? "translate-x-5" : "translate-x-0"
]
%>

<%= button_tag **input_options,
  class: class_names(button_classes),
  role: "switch",
  type: "button",
  "@click.stop": "value = !value" do %>
  <%= tag.span "aria-hidden": true, class: class_names(span_classes) %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lookbook-1.2.1 app/views/lookbook/previews/inputs/_toggle.html.erb
lookbook-1.2.0 app/views/lookbook/previews/inputs/_toggle.html.erb
lookbook-1.1.1 app/views/lookbook/previews/inputs/_toggle.html.erb
lookbook-1.1.0 app/views/lookbook/previews/inputs/_toggle.html.erb