-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5c0e03
commit cb0b476
Showing
9 changed files
with
782 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2023 Alin (https://codepen.io/alin_trinca/pen/gOQeyvB) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 021 Sidebar Navigation Bar | ||
|
||
A Pen created on CodePen.io. Original URL: [https://codepen.io/alin_trinca/pen/gOQeyvB](https://codepen.io/alin_trinca/pen/gOQeyvB). | ||
|
||
![Sidebar Navigation Bar Screenshot](sidebar-navigation-bar.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" > | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>CodePen - 021 Sidebar Navigation Bar</title> | ||
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css'><link rel="stylesheet" href="./style.css"> | ||
|
||
</head> | ||
<body> | ||
<!-- partial:index.partial.html --> | ||
<div class="sidebar"> | ||
<div class="logo"> | ||
<i class="fa-brands fa-codepen logo__icon"></i> | ||
<div class="logo__name">Codepen</div> | ||
<i class="fa-solid fa-bars" id="btn"></i> | ||
</div> | ||
|
||
<ul class="nav"> | ||
<li> | ||
<i class="fa-solid fa-magnifying-glass"></i> | ||
<input type="text" placeholder="Search..."> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-solid fa-table-cells-large"></i> | ||
<span class="links_name">Dashboard</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-regular fa-user"></i> | ||
<span class="links_name">User</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-regular fa-comment"></i> | ||
<span class="links_name">Messages</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-solid fa-chart-line"></i> | ||
<span class="links_name">Analytics</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-regular fa-folder"></i> | ||
<span class="links_name">File Manager</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-solid fa-cart-arrow-down"></i> | ||
<span class="links_name">Order</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-regular fa-star"></i> | ||
<span class="links_name">Saved</span> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="javascript:void(0)"> | ||
<i class="fa-solid fa-gear"></i> | ||
<span class="links_name">Settings</span> | ||
</a> | ||
</li> | ||
<li class="profile"> | ||
<div class="profile-details"> | ||
<img src="https://images.pexels.com/photos/2269872/pexels-photo-2269872.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="profileImg"> | ||
<div class="name_job"> | ||
<div class="name">John</div> | ||
<div class="job">Developer</div> | ||
</div> | ||
</div> | ||
<i class="fa-solid fa-arrow-right-from-bracket log_out"></i> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="home-section"> | ||
<div class="text">Dashboard</div> | ||
</div> | ||
<!-- partial --> | ||
<script src="./script.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const sidebar = document.querySelector(".sidebar"); | ||
const closeBtn = document.querySelector("#btn"); | ||
const searchBtn = document.querySelector(".fa-magnifying-glass"); | ||
|
||
const toggleSidebar = () => { | ||
sidebar.classList.toggle("open"); | ||
menuBtnChange(); | ||
}; | ||
|
||
const menuBtnChange = () => { | ||
if (sidebar.classList.contains("open")) { | ||
closeBtn.classList.replace("fa-bars", "fa-angle-left"); | ||
} else { | ||
closeBtn.classList.replace("fa-angle-left", "fa-bars"); | ||
} | ||
}; | ||
|
||
closeBtn.addEventListener("click", toggleSidebar); | ||
searchBtn.addEventListener("click", toggleSidebar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
@import url("https://fonts.googleapis.com/css2?family=Mulish:ital,wght@0,400;0,700;1,400&display=swap"); | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: inherit; | ||
} | ||
|
||
html { | ||
font-size: 62.5%; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
font-family: "Mulish", sans-serif; | ||
color: #b9e0f2; | ||
line-height: 1.5; | ||
min-height: 100vh; | ||
position: relative; | ||
background: #0f172a; | ||
} | ||
|
||
::-webkit-scrollbar { | ||
width: 10px; | ||
} | ||
::-webkit-scrollbar-track { | ||
background: #f1f1f1; | ||
} | ||
::-webkit-scrollbar-thumb { | ||
background: #888; | ||
} | ||
::-webkit-scrollbar-thumb:hover { | ||
background: #555; | ||
} | ||
|
||
.sidebar { | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
height: 100%; | ||
width: 80px; | ||
background-color: #131c31; | ||
padding: 5px 15px; | ||
z-index: 99; | ||
transition: all 0.5s ease; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
} | ||
.sidebar i[class^=fa-] { | ||
color: #fff; | ||
height: 60px; | ||
min-width: 50px; | ||
font-size: 2.8rem; | ||
text-align: center; | ||
line-height: 60px; | ||
} | ||
.sidebar .logo { | ||
height: 60px; | ||
display: flex; | ||
align-items: center; | ||
position: relative; | ||
} | ||
.sidebar .logo__icon { | ||
opacity: 0; | ||
transition: all 0.5s ease; | ||
} | ||
.sidebar .logo__name { | ||
color: #fff; | ||
font-size: 2rem; | ||
font-weight: 700; | ||
opacity: 0; | ||
transition: all 0.5s ease; | ||
} | ||
.sidebar .logo #btn { | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
transition: all 0.4s ease; | ||
font-size: 2.5rem; | ||
text-align: center; | ||
cursor: pointer; | ||
transition: all 0.5s ease; | ||
} | ||
.sidebar .nav { | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 20px; | ||
} | ||
.sidebar .nav li { | ||
position: relative; | ||
margin: 7px 0; | ||
list-style: none; | ||
} | ||
.sidebar .nav li input { | ||
font-size: 1.5rem; | ||
color: #fff; | ||
height: 50px; | ||
width: 50px; | ||
background: transparent; | ||
border: 2px solid #11101d; | ||
outline: none; | ||
border-radius: 6px; | ||
transition: all 0.5s ease; | ||
} | ||
.sidebar .nav li .fa-magnifying-glass { | ||
position: absolute; | ||
top: 50%; | ||
left: 0; | ||
transform: translateY(-50%); | ||
font-size: 2.2rem; | ||
background: #11101d; | ||
color: #b9e0f2; | ||
cursor: pointer; | ||
} | ||
.sidebar .nav li .fa-magnifying-glass:hover { | ||
background: #fff; | ||
color: #11101d; | ||
} | ||
.sidebar .nav li a { | ||
display: flex; | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 6px; | ||
align-items: center; | ||
text-decoration: none; | ||
background: #11101d; | ||
transition: all 0.4s ease; | ||
} | ||
.sidebar .nav li a:hover { | ||
background: #fff; | ||
transition: all 0.4s ease; | ||
} | ||
.sidebar .nav li a .links_name { | ||
color: #fff; | ||
font-size: 15px; | ||
font-weight: 400; | ||
white-space: nowrap; | ||
opacity: 0; | ||
pointer-events: none; | ||
transition: 0.4s; | ||
} | ||
.sidebar .nav li a:hover .links_name, .sidebar .nav li a:hover i { | ||
transition: all 0.5s ease; | ||
color: #11101d; | ||
} | ||
.sidebar .nav li i { | ||
color: #b9e0f2; | ||
height: 50px; | ||
line-height: 50px; | ||
font-size: 1.8rem; | ||
border-radius: 6px; | ||
} | ||
.sidebar .nav li.profile { | ||
width: 50px; | ||
height: 50px; | ||
padding: 10px 15px; | ||
background: #11101d; | ||
border-radius: 6px; | ||
transition: all 0.5s ease; | ||
overflow: hidden; | ||
cursor: pointer; | ||
} | ||
.sidebar .nav li.profile .profile-details { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: nowrap; | ||
opacity: 0; | ||
} | ||
.sidebar .nav li.profile img { | ||
height: 45px; | ||
width: 45px; | ||
object-fit: cover; | ||
border-radius: 6px; | ||
margin-right: 10px; | ||
} | ||
.sidebar .nav li.profile .name, | ||
.sidebar .nav li.profile .job { | ||
font-size: 15px; | ||
font-weight: 400; | ||
color: #fff; | ||
white-space: nowrap; | ||
} | ||
.sidebar .nav li.profile .job { | ||
font-size: 12px; | ||
} | ||
.sidebar .nav li.profile .log_out { | ||
position: absolute; | ||
top: 50%; | ||
right: 0; | ||
transform: translateY(-50%); | ||
background: #11101d; | ||
width: 100%; | ||
height: 50px; | ||
line-height: 50px; | ||
border-radius: 6px; | ||
transition: all 0.4s ease; | ||
} | ||
.sidebar .nav li.profile .log_out:hover { | ||
color: #fff; | ||
} | ||
.sidebar.open { | ||
width: 250px; | ||
} | ||
.sidebar.open .logo__icon, .sidebar.open .logo__name { | ||
opacity: 1; | ||
} | ||
.sidebar.open .logo #btn { | ||
text-align: right; | ||
right: 0; | ||
} | ||
.sidebar.open li a { | ||
width: 100%; | ||
} | ||
.sidebar.open li a .links_name { | ||
opacity: 1; | ||
pointer-events: auto; | ||
} | ||
.sidebar.open li input { | ||
padding: 0 10px 0 60px; | ||
width: 100%; | ||
} | ||
.sidebar.open li .fa-magnifying-glass:hover { | ||
background-color: #11101d; | ||
color: #fff; | ||
} | ||
.sidebar.open li.profile { | ||
width: 100%; | ||
height: 60px; | ||
} | ||
.sidebar.open li.profile .profile-details { | ||
opacity: 1; | ||
} | ||
.sidebar.open li.profile .log_out { | ||
width: 50px; | ||
background: none; | ||
} | ||
|
||
.home-section { | ||
position: relative; | ||
min-height: 100vh; | ||
top: 0; | ||
left: 80px; | ||
width: calc(100% - 80px); | ||
transition: all 0.5s ease; | ||
z-index: 2; | ||
} | ||
.home-section .text { | ||
display: inline-block; | ||
color: #b9e0f2; | ||
font-size: 3rem; | ||
line-height: 1; | ||
font-weight: 700; | ||
margin: 20px; | ||
} | ||
|
||
.sidebar.open ~ .home-section { | ||
left: 250px; | ||
width: calc(100% - 250px); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.