ResponsiveNavbarWithDropdownAndIcons

InfoGeneratePackages

The code defines a Ruby class named `NavbarWithDropdownCenterLogoAndIconComponent` that inherits from `ApplicationComponent`. This class builds a navbar structure using a templating method called `template`. Within the navbar, there are three main sections:
1. `navbar-start` contains a dropdown menu with links labeled "Homepage", "Portfolio", and "About". This dropdown is triggered by a button designed as a rounded ghost button with a horizontal menu icon.
2. `navbar-center` features a central text element (`daisyUI`) styled as a ghost button.
3. `navbar-end` incorporates two icon buttons: one for search functionality, indicated by a magnifying glass icon, and another for notifications, shown with a bell icon and a primary-colored badge to indicate new notifications.

The navbar is designed with responsiveness and aesthetics in mind, utilizing classes for background, shadow, rounded corners, and color consistency from a CSS framework likely to be Tailwind CSS with daisyUI components. The application of SVGs for icons suggests a focus on clean, scalable graphics.

# frozen_string_literal: true

class NavbarWithDropdownCenterLogoAndIconComponent < ApplicationComponent
  def template
    div(class: "navbar bg-base-100") do
      div(class: "navbar-start") do
        div(class: "dropdown") do
          div(tabindex: "0", role: "button", class: "btn btn-ghost btn-circle") do
            svg(xmlns: "http://www.w3.org/2000/svg", class: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor") do |svg|
              svg.path(stroke_linecap: "round", stroke_linejoin: "round", stroke_width: "2", d: "M4 6h16M4 12h16M4 18h7")
            end
          end
          ul(tabindex: "0", class: "menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52") do
            li { a { "Homepage" } }
            li { a { "Portfolio" } }
            li { a { "About" } }
          end
        end
      end
      div(class: "navbar-center") do
        a(class: "btn btn-ghost text-xl") { "daisyUI" }
      end
      div(class: "navbar-end") do
        button(class: "btn btn-ghost btn-circle") do
          svg(xmlns: "http://www.w3.org/2000/svg", class: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor") do |svg|
            svg.path(stroke_linecap: "round", stroke_linejoin: "round", stroke_width: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z")
          end
        end
        button(class: "btn btn-ghost btn-circle") do
          div(class: "indicator") do
            svg(xmlns: "http://www.w3.org/2000/svg", class: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor") do |svg|
              svg.path(stroke_linecap: "round", stroke_linejoin: "round", stroke_width: "2", d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9")
            end
            span(class: "badge badge-xs badge-primary indicator-item")
          end
        end
      end
    end
  end
end