Sha256: 4adedcb27350f69aced5bfe3b75b56549c19bb2cd40b68b197a1d7c8ebe92643

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Maquina
  module Navbar
    class MobileButton < Phlex::HTML
      include ApplicationView

      def view_template(&block)
        div class: "flex items-center lg:hidden" do
          button type: "button", class: "mobile-button", "aria-controls": "mobile-menu", "aria-expanded": false, "data-action": "mobile-menu#toggle" do
            span(class: "sr-only") { "Open main menu" }
            svg_icon(:outline, data: {"mobile-menu-target": :open}, icon: closed_icon)
            svg_icon(:outline, css_class: "hidden h-6 -w6", data: {"mobile-menu-target": :close}, icon: opened_icon)
          end
        end
      end

      private

      def closed_icon
        "M4 6h16M4 12h16M4 18h16"
      end

      def opened_icon
        "M6 18L18 6M6 6l12 12"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maquina-0.7.2 app/views/maquina/navbar/mobile_button.rb
maquina-0.7.1 app/views/maquina/navbar/mobile_button.rb
maquina-0.5.2 app/views/maquina/navbar/mobile_button.rb
maquina-0.5.1 app/views/maquina/navbar/mobile_button.rb