Tidy up homepage and navigation
This commit is contained in:
33
app/helpers/navigation_helper.rb
Normal file
33
app/helpers/navigation_helper.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module NavigationHelper
|
||||
def nav_link_class(path)
|
||||
current = request.path == path || (path == root_path && request.path == events_path && !request.path.include?('/network_ranges') && !request.path.include?('/rules'))
|
||||
|
||||
if current
|
||||
"bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"
|
||||
else
|
||||
"text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
|
||||
end
|
||||
end
|
||||
|
||||
def mobile_nav_link_class(path)
|
||||
current = request.path == path || (path == root_path && request.path == events_path && !request.path.include?('/network_ranges') && !request.path.include?('/rules'))
|
||||
|
||||
if current
|
||||
"bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium"
|
||||
else
|
||||
"text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium transition-colors"
|
||||
end
|
||||
end
|
||||
|
||||
def time_period_class(period)
|
||||
base_class = "px-4 py-2 text-sm font-medium border-r last:border-r-0 transition-colors"
|
||||
|
||||
if @time_period == period
|
||||
base_class + " bg-blue-600 text-white"
|
||||
else
|
||||
base_class + " bg-white text-gray-700 hover:bg-gray-50"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user