akkounts/app/components/header_tab_link_component.rb
Râu Cao 462dd24da3
All checks were successful
continuous-integration/drone/push Build is passing
WIP contribution nav
2023-06-12 14:32:59 +02:00

21 lines
589 B
Ruby

# frozen_string_literal: true
class HeaderTabLinkComponent < ViewComponent::Base
def initialize(name:, path:, active: false, disabled: false)
@name = name
@path = path
@active = active
@disabled = disabled
@link_class = class_names_link(path)
end
def class_names_link(path)
common = "block md:inline-block px-5 py-2 rounded-md font-medium text-base md:text-xl"
if @active
"#{common} bg-gray-900/50 text-white"
else
"#{common} text-gray-300 hover:bg-gray-900/30 hover:text-white active:bg-gray-900/30 active:text-white"
end
end
end