Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
modify navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina committed May 13, 2022
1 parent 43fa254 commit 53a536a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
10 changes: 5 additions & 5 deletions public/js/navbar_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ var toggleMenu = document.getElementById('menu-toggle');
var menuList = document.getElementById('menu-list');
var menuOption = document.getElementsByClassName('rent-menu-option');

toggleMenu.onclick = function (event) {
event.preventDefault();
menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px' : '0px';
};

menuOption[0].onclick = function (event) {
event.preventDefault();
window.location.href = window.location.origin + '/find/car';
Expand All @@ -23,10 +28,5 @@ showButton.onclick = function (event) {
event.preventDefault();
showMenu.style.display = showMenu.style.display == 'none' ? 'block' : 'none';
};

toggleMenu.onclick = function (event) {
event.preventDefault();
menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px' : '0px';
};
/******/ })()
;
10 changes: 5 additions & 5 deletions resources/js/navbar_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const toggleMenu = document.getElementById('menu-toggle');
const menuList = document.getElementById('menu-list');
const menuOption = document.getElementsByClassName('rent-menu-option');

toggleMenu.onclick = (event) => {
event.preventDefault();
menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px': '0px';
}

menuOption[0].onclick = (event) => {
event.preventDefault();
window.location.href = window.location.origin + '/find/car';
Expand All @@ -17,9 +22,4 @@ menuOption[1].onclick = (event) => {
showButton.onclick = (event) => {
event.preventDefault();
showMenu.style.display = showMenu.style.display == 'none' ? 'block': 'none';
}

toggleMenu.onclick = (event) => {
event.preventDefault();
menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px': '0px';
}
20 changes: 12 additions & 8 deletions resources/views/components/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
<div class="w-screen h-1 bg-lilac-100"></div>
<div class="navbar flex justify-between">
<a href="{{ url('/') }}"><div class="navbar-logo basis-1/4 text-lilac-100">Rent.ly</div></a>
<div class="basis-3/4 flex justify-between sm:max-h-0 md:max-h-0" id="menu-list">
<div class="basis-3/4 flex justify-between sm:max-h-0 md:max-h-0 bg-white" id="menu-list">
<div class="navbar-links flex p-3 m-3">
@guest
<?php $values = array('Rent', 'Guide', 'Help', 'About'); ?>
<?php $values = array('Rent' => 'rent', 'Guide' => 'guide', 'Help' => 'help', 'About' => 'about'); ?>
@endguest
@auth
<?php $values = array('Rent', 'My order', 'Guide', 'Help', 'About'); ?>
@if(auth()->user()->hasRole('user'))
<?php $values = array('Rent' => 'rent', 'My order' => 'me/order', 'Guide' => 'guide', 'Help' => 'help', 'About' => 'about'); ?>
@else
<?php $values = array('Order' => 'dashboard/orders', 'Product' => 'dashboard/vehicles', 'Customer' => 'dashboard/customers') ?>
@endif
@endauth
@foreach($values as $value)
<a href="{{ $isRent($value) ? '' : url(strtolower($value)) }}">
<div id="{{ $isRent($value) ? 'rent-button' : '' }}" class="relative navbar-option mx-6 whitespace-nowrap {{ Auth::check() ? 'w-24' : 'w-20' }}">
<p class="inline-block w-8 px-2 text-center {{ $isSelected($value) ? 'font-bold' : '' }}"> {{ $value }} </p>
@if($isRent($value))
@foreach($values as $key => $value)
<a href="{{ $isRent($key) ? '' : url($value) }}">
<div id="{{ $isRent($key) ? 'rent-button' : '' }}" class="relative navbar-option mx-6 whitespace-nowrap {{ Auth::check() ? 'w-24' : 'w-20' }}">
<p class="inline-block w-8 px-2 text-center {{ $isSelected($key) ? 'font-bold' : '' }}"> {{ $key }} </p>
@if($isRent($key))
<img src="{{ asset('images/down-arrow.svg') }}" class="inline-block w-5 ml-3 pl-1">
<div id="rent-menu" class="rent-menu z-10 hidden absolute w-40 font-normal bg-white">
<div class="rent-menu-option px-2 py-1 bg-gray hover:bg-lilac-100 hover:text-white">
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use App\Http\Controllers\BasicViewController;
use App\Http\Controllers\RentController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\AdminController;

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 53a536a

Please sign in to comment.