Skip to content

Commit

Permalink
Fix navbar responsive behavior
Browse files Browse the repository at this point in the history
it was removed the background color of the navbar, the logo re-sizing works well,
also, was added more spacing between menu options and button and was added max-width resolution.
  • Loading branch information
AlejandroVI99 committed Oct 12, 2021
1 parent 8af44b0 commit a35d11f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
11 changes: 6 additions & 5 deletions app/assets/stylesheets/home/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ $bright-cyan: #5eefe1;
margin-left: auto;
}

.container-fluid{
max-width:1920px;
}

nav {
display: block;
padding-left: 5%;
Expand All @@ -20,10 +24,6 @@ nav {
font-weight: bold;
}

.navbar{
background-image: radial-gradient(circle at 120.71% 50%, #7043f3 0, #3c3cf2 50%, #0037f1 100%);
}

#logo {
margin-top: 20px;
margin-bottom: 20px;
Expand Down Expand Up @@ -106,7 +106,6 @@ nav {
width: 250px;
margin-left: 0px;
}

}

@media (min-width:992px){
Expand All @@ -125,6 +124,7 @@ nav {
}

#link {
margin: 16.5px 15px 11.5px 15px;
&:hover {
@extend %text-under;
}
Expand All @@ -135,6 +135,7 @@ nav {
border: 2px solid white;
font-weight: bold;
border-radius: 8px;
margin: 16.5px 15px 11.5px 15px;
width: 100px;
&:hover {
color: $bright-cyan;
Expand Down
9 changes: 6 additions & 3 deletions app/javascript/packs/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ document.addEventListener("turbolinks:load", function () {
}

window.addEventListener("resize", function(){
if (window.matchMedia("(min-width: 992px)").matches){
let aria = document.getElementById('button').getAttribute("aria-expanded");
if ((aria == "true") && (window.matchMedia("(min-width: 992px)").matches)) {
logoContainer.className = 'logo-container-close';
document.getElementById("logo").setAttribute('src', logos[0]);
}else{
if (!document.getElementById('button').classList.contains('collapsed')) {
}else {
if ((aria == "true")) {
logoContainer.className = 'logo-container-open';
document.getElementById("logo").setAttribute('src', logos[1]);
}
}
Expand Down
19 changes: 10 additions & 9 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<nav class="navbar navbar-expand-lg navbar-light ">
<div class="container-fluid">
<div class="logo-container-close" id = "logo-container">
<div class="logo-container-close" id="logo-container">
<%= image_tag "BCnameLogo.png", alt: t('menu.logo'), class: "logo-closed", id:"logo" %>
</div>
<button id="button" class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02"
aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation" style="border: none; box-shadow: none">
<button id="button" class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false"
aria-label="Toggle navigation" style="border: none; box-shadow: none">
<%= image_tag "list.svg", alt: t('menu.logo'), id:"image" %>
</button>
<div class="collapse navbar-collapse " id="navbarTogglerDemo02">
Expand All @@ -24,13 +25,13 @@
<li class="nav-item" id="borderContacto">
<a class="nav-link" aria-current="page" href="#" id="linkContacto"><%= t('menu.contact') %></a>
</li>


</div>
<div class="group609">
<%= image_tag "Group 609.svg", alt: "group609" %>
</div>
<div class="group609">
<%= image_tag "Group 609.svg", alt: "group609" %>
</div>
</div>
</div>
</nav>

<%= javascript_pack_tag 'navbar', 'data-turbolinks-track': 'reload' %>

<%= javascript_pack_tag 'navbar', 'data-turbolinks-track': 'reload' %>

1 comment on commit a35d11f

@cfcortes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull reviewers stats for the lasts 30 days:

User Avg. time to first review Total pull reviews Total comments
YilKanda
πŸ₯‡
7d 1h 30m
β–€β–€
3
β–€β–€β–€β–€
2
β–€β–€β–€β–€β–€
RobertoCarMed
πŸ₯ˆ
21d 2h 29m
β–€β–€β–€β–€β–€β–€
1
β–€
2
β–€β–€β–€β–€β–€
SampabloC
πŸ₯‰
1d 7h 20m
1
β–€
0
EduardoGHdez
3d 22h
β–€
1
β–€
0
xFerchoVJ
4h 32m
1
β–€
0

Please sign in to comment.