Navbar active classes.

This commit is contained in:
Graphictoria 2022-04-15 23:58:55 -04:00
parent 4c8ea3e2b5
commit d94a73674b
1 changed files with 5 additions and 5 deletions

View File

@ -3,15 +3,15 @@
$routes = [ $routes = [
[ [
"label" => "Games", "label" => "Games",
"location" => "/games" "location" => "games"
], ],
[ [
"label" => "Shop", "label" => "Shop",
"location" => "/shop" "location" => "shop"
], ],
[ [
"label" => "Forum", "label" => "Forum",
"location" => "/forum" "location" => "forum"
] ]
] ]
@endphp @endphp
@ -32,13 +32,13 @@
$route = (object)$route; $route = (object)$route;
@endphp @endphp
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ $route->location }}">{{ $route->label }}</a> <a class="nav-link{{ str_starts_with(Request::path(), $route->location) ? ' active' : '' }}" href="{{ url('/' . $route->location) }}">{{ $route->label }}</a>
</li> </li>
@endforeach @endforeach
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="graphictoria-nav-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">More</a> <a class="nav-link dropdown-toggle" href="#" id="graphictoria-nav-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">More</a>
<ul class="dropdown-menu graphictoria-nav-dropdown" area-labelledby="graphictoria-nav-dropdown"> <ul class="dropdown-menu graphictoria-nav-dropdown" area-labelledby="graphictoria-nav-dropdown">
<li><a class="dropdown-item" href="/users">Users</a></li> <li><a class="dropdown-item{{ str_starts_with(Request::path(), 'users') ? ' active' : '' }}" href="{{ url('/users') }}">Users</a></li>
<li><a class="dropdown-item" href="https://discord.gg/q666a2sF6d" target="_blank" rel="noreferrer">Discord</a></li> <li><a class="dropdown-item" href="https://discord.gg/q666a2sF6d" target="_blank" rel="noreferrer">Discord</a></li>
</ul> </ul>
</li> </li>