Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navbar UI revamp #8032

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/contributors.css
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ body {
position: relative;
height: var(--toggleHeight);
width: var(--toggleWidth);
min-width: 4.5rem;
border-radius: var(--toggleHeight);
transition: all 0.5s ease-in-out;
background: var(--bgColor--night);
Expand Down
14 changes: 14 additions & 0 deletions css/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,17 @@ nav{
.navbar-light .navbar-nav .nav-link:hover{
color:#dc143c
}

ul#socialmenu {
justify-content: flex-end;
}

.social-icon {
display: flex;
align-items: center;
}

.social-icon i {
margin-right: 5px; /* Space between icon and text */
}

15 changes: 9 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@
</path>
</svg>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01"
<button class="navbar-toggler" type="button" data-toggle="collapse" data-bs-target="#navbarColor01"
aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor01">
<ul class="navbar-nav mr-auto" id="menu">
<!-- Navbar items will be dynamically added -->
</ul>
<ul class="navbar-nav mr-auto" id="socialmenu"></ul>
<div class="tdnn">
<div class="moon"></div>
</div>
</div>
</nav>

Expand All @@ -75,9 +79,7 @@
<div class="container">
<span class="heading"><b>CONTRIBUTORS</b> </span>
<div class="heart"></div>
<div class="tdnn">
<div class="moon"></div>
</div>

<div class="d-flex justify-content-between align-items-center">
<p class="rubberBand delay-4s">Add yourself to the list if you contribute.</p>
<div class="inputs mr-3">
Expand Down Expand Up @@ -133,8 +135,9 @@ <h3>Hacktoberfest <span id="current-year-footer"></span></h3>
<!-- JavaScript Dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6QA4fZSN7NTMZBeZfFgOwOLfLZc4eME6vH3kn4tEWvJgC4ndOlxogypGLyBI"
crossorigin="anonymous"></script>
integrity="sha384-MrcW6QA4fZSN7NTMZBeZfFgOwOLfLZc4eME6vH3kn4tEWvJgC4ndOlxogypGLyBI"
crossorigin="anonymous"></script>

<script src="https://kit.fontawesome.com/d9f7ec7b29.js" crossorigin="anonymous"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
Expand Down
1 change: 1 addition & 0 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ $(".tdnn").click(function () {
$(".tdnn").toggleClass("day");
});


// Display live stats with the dynamic year
document.getElementById(
"stats"
Expand Down
130 changes: 60 additions & 70 deletions scripts/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,78 @@ const menu = {
'Home': {
'text': 'Contribute here',
'href': 'https://github.com/fineanmol/Hacktoberfest2022/blob/master/contributors/contributorsList.js#L1934'
},'hacktoberfest1':{
'text':'HacktoberFest Project 1',
'href':'https://github.com/fineanmol/Annoying-submit-button'

},'hacktoberfest2':{
'text':'HacktoberFest Project 2',
'href':'https://github.com/fineanmol/hacktoberfest'

},
//'Others': {
'Instagram': {
'text': 'Instagram Connect',
'href': 'https://instagram.com/fineanmol'
},
'Instagram': {
'text': 'Connect on <i class="fa fa-instagram" style="font-size:22px"></i>',
'href': 'https://instagram.com/fineanmol'
},
'Facebook': {
'text': '<i class="fa fa-facebook" style="font-size:20px"></i>acebook',
'href': 'https://www.facebook.com/fineanmol',
'id': 'facebook'
},
'Linkedin': {
'text': 'Linked<i class="fa fa-linkedin" style="font-size:20px"></i>',
'href': 'https://www.linkedin.com/in/fineanmol/',
'id': 'linkedin'
},
'NDC': {
'text': '<i class="fa fa-twitter" style="font-size:20px"></i>Twitter',
'href': 'https://twitter.com/fineanmol',
'id': 'tools'
},
'Stars': {
'text': '<a class="github-button" href="https://github.com/fineanmol/Hacktoberfest2022" data-icon="octicon-star" data-show-count="true" aria-label="Star fineanmol/Hacktoberfest2022 on GitHub">Stars</a>',
'href': 'https://github.com/fineanmol/Hacktoberfest2022',
'id': 'tools'
},
'Forks': {
'text': '<a class="github-button" href="https://github.com/fineanmol/Hacktoberfest2022/fork" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork fineanmol/Hacktoberfest2022 on GitHub">Fork</a>',
'href': 'https://github.com/fineanmol/Hacktoberfest2022',
'id': 'tools'
}

},
'hacktoberfest1': {
'text': 'HacktoberFest Project 1',
'href': 'https://github.com/fineanmol/Annoying-submit-button'
},
'hacktoberfest2': {
'text': 'HacktoberFest Project 2',
'href': 'https://github.com/fineanmol/hacktoberfest'
}
}

const socialmenu = {
'Emptyone': {
'text': '<span style="display: flex; align-items: center;"><i style="font-size:25px; "></i><<<<</span>',
},
'Stars': {
'text': '<a class="github-button" href="https://github.com/fineanmol/Hacktoberfest2022" data-icon="octicon-star" data-show-count="true" aria-label="Star fineanmol/Hacktoberfest2022 on GitHub">Stars</a>',
'href': 'https://github.com/fineanmol/Hacktoberfest2022',
'id': 'tools'
},
'Forks': {
'text': '<a class="github-button" href="https://github.com/fineanmol/Hacktoberfest2022/fork" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork fineanmol/Hacktoberfest2022 on GitHub">Fork</a>',
'href': 'https://github.com/fineanmol/Hacktoberfest2022',
'id': 'tools'
},
'Emptytwo': {
'text': '<span style="display: flex; align-items: center;"><i style="font-size:25px; "></i>>>>></span>',
},
'Instagram': {
'text': '<span style="display: flex; align-items: center;"><i class="fa fa-instagram" style="font-size:22px; margin-left: 7px; margin-right: 5px;"></i>Instagram</span>',
'href': 'https://instagram.com/fineanmol'
},
'Facebook': {
'text': '<span style="display: flex; align-items: center;"><i class="fa fa-facebook" style="font-size:20px;"></i>acebook</span>',
'href': 'https://www.facebook.com/fineanmol',
'id': 'facebook'
},
'Linkedin': {
'text': '<span style="display: flex; align-items: center;">Linked<i class="fa fa-linkedin" style="font-size:20px; margin-right: 5px;"></i></span>',
'href': 'https://www.linkedin.com/in/fineanmol/',
'id': 'linkedin'
},
'NDC': {
'text': '<span style="display: flex; align-items: center;"><i class="fa fa-twitter" style="font-size:20px; margin-right: 5px;"></i>Twitter</span>',
'href': 'https://twitter.com/fineanmol',
'id': 'tools'
}
}

function buildMenuHTML (obj = {}) {
function buildMenuHTML(obj = {}, targetId) {
let html = ''
let path = window.location.pathname.split('/')
let currentPage = path[path.length - 1] === '' ? '/' : path[path.length - 1]

Object.entries(obj).forEach(([key, item]) => {
if (key == 'Others') {
html += '<li class="dropdown">'
html += '<a class="nav-link nested-dropdown" href="#" id="Others"> Others </a>'
html += '<div class="dropdown-content">'
Object.entries(item).forEach(([key, item]) => {
let isCurrent = (currentPage === item.href)

html += '<div class="nav-item' + (isCurrent ? ' active' : '') + '">'
html += '<a target="_blank" class="nav-link" href="' + item.href + '"' + (item.id ? ' id="' + item.id + '"' : '') + '>' + item.text + '</a>'
html += '</div>'
})
html += '</div>'
} else {
if (currentPage.indexOf('.html') == -1) {
currentPage = currentPage.concat('.html')
}
if (currentPage.indexOf('.html') == -1) {
currentPage = currentPage.concat('.html')
}

let isCurrent = (currentPage === item.href)
let isCurrent = (currentPage === item.href)

html += '<li class="nav-item' + (isCurrent ? ' active' : '') + '">'
html += '<a target="_blank" class="nav-link" href="' + item.href + '"' + (item.id ? ' id="' + item.id + '"' : '') + '>' + item.text + '</a>'
html += '</li>'
}
html += '<li class="nav-item' + (isCurrent ? ' active' : '') + '">'
html += '<a target="_blank" class="nav-link"' + (item.href ? ' href="' + item.href + '"' : '') + (item.id ? ' id="' + item.id + '"' : '') + '>' + item.text + '</a>'
html += '</li>'
})
document.getElementById('menu').innerHTML = html

document.getElementById(targetId).innerHTML = html
}

function buildMenu () {
buildMenuHTML(menu)
function buildMenu() {
buildMenuHTML(menu, 'menu') // Populate main menu
buildMenuHTML(socialmenu, 'socialmenu') // Populate social menu
}

buildMenu()
buildMenu()
Loading