Sha256: 193f572d750daceafdb6512e6ca4a9cd93556460a13a22e7e6739638e8384856
Contents?: true
Size: 984 Bytes
Versions: 12
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true require 'tramway/navbar' module Tramway module Helpers # Provides navbar helpers for ActionView module NavbarHelper def tramway_navbar(**options) initialize_navbar yield @navbar if block_given? assign_navbar_items(options) render_navbar_component(options) end private def initialize_navbar @navbar = Tramway::Navbar.new self end def assign_navbar_items(options) navbar_items = @navbar.items navbar_items.each do |(key, value)| key_to_merge = case key when :left, :right "#{key}_items".to_sym else key end options.merge! key_to_merge => value end end def render_navbar_component(options) render(Tailwinds::NavbarComponent.new(**options)) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems