forked from guevaraia/ui
-
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
Showing
6 changed files
with
295 additions
and
68 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,65 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Dropdown Menu 06</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" | ||
rel="stylesheet" | ||
> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<nav class="dropdown"> | ||
<button class="main-item"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="market-insights-icon" aria-hidden="true" role="img" | ||
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> | ||
<title id="market-insights-icon">Market Insight Icon</title> | ||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M4 20l14 0" /> | ||
</svg> | ||
Market Insights | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
class="expand-icon" | ||
aria-labelledby="exp-icon" | ||
role="img" | ||
aria-hidden="true" | ||
width="44" | ||
height="44" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
fill="none" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
> | ||
<title id="exp-icon">Expand/Collapse Menu</title> | ||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/> | ||
<path d="M9 6l6 6l-6 6" /> | ||
</svg> | ||
</button> | ||
<ul> | ||
<li> | ||
<a href="#market-trends"> | ||
Market Trends | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#expert-analysis"> | ||
Expert Analysis | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#event-calendar"> | ||
Event Calendar | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<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,44 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Dropdown Menu 06</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" | ||
rel="stylesheet" | ||
> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<nav class="dropdown"> | ||
<button class="main-item"> | ||
<!-- svg market --> | ||
Market Insights | ||
<!-- svg down icon --> | ||
</button> | ||
<ul> | ||
<li> | ||
<a href="#market-trends"> | ||
Market Trends | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#expert-analysis"> | ||
Expert Analysis | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#event-calendar"> | ||
Event Calendar | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<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,14 @@ | ||
const mainItems = document.querySelectorAll( | ||
'.main-item' | ||
); | ||
|
||
mainItems.forEach((mainItem) => { | ||
mainItem.addEventListener('click', () => { | ||
mainItem.classList.toggle( | ||
'main-item--open' | ||
); | ||
}) | ||
}); | ||
|
||
|
||
|
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,158 @@ | ||
|
||
|
||
:root { | ||
--background: #121826; | ||
--primary-item: #FEFEFE; | ||
--background-item: #121826; | ||
--background-item-hover: #292F3B; | ||
--item-non-hover: #FEFEFE; | ||
--text-link: #C9CDD2; | ||
--text-link-accent: #DADBDE; | ||
--line-color: #222836; | ||
} | ||
|
||
html { | ||
font-size: 16px; | ||
font-family: "Poppins", sans-serif; | ||
} | ||
|
||
body { | ||
background: var(--background); | ||
height: 100vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
.dropdown { | ||
min-width: 10rem; | ||
width: 100%; | ||
max-width: 16rem; | ||
padding: 1rem; | ||
border-radius: 1rem; | ||
overflow: hidden; | ||
background-color: var( | ||
--background-item | ||
); | ||
} | ||
|
||
.main-item { | ||
padding: 0.5rem; | ||
display: flex; | ||
cursor: pointer; | ||
align-items: center; | ||
justify-content: start; | ||
border-radius: 0.5rem; | ||
user-select: none; | ||
font-size: 1rem; | ||
font-family: 'Poppins', sans-serif; | ||
gap: 1rem; | ||
border: none; | ||
width: 100%; | ||
background: var(--background-item); | ||
transition: all ease-in-out 0.25s; | ||
color: var(--item-non-hover); | ||
} | ||
|
||
.main-item:hover { | ||
background-color: var( | ||
--background-item-hover | ||
); | ||
color: var(--item-non-hover); | ||
} | ||
|
||
.main-item svg { | ||
stroke: var(--item-non-hover); | ||
transition: all ease-in-out 0.25s; | ||
} | ||
|
||
.main-item:hover svg { | ||
stroke: var(--primary-item); | ||
} | ||
|
||
.main-item--open { | ||
border-radius: 8px; | ||
transition: all 200ms; | ||
color: var(--primary-item); | ||
} | ||
|
||
.main-item--open:hover { | ||
color: var(--primary-item); | ||
border-radius: 8px; | ||
background-color: var( | ||
--background-item-hover); | ||
} | ||
|
||
.main-item--open svg { | ||
stroke: var(--primary-item); | ||
} | ||
|
||
.dropdown > ul { | ||
max-height: 0px; | ||
list-style-type: none; | ||
margin: 0px; | ||
padding-left: 14px; | ||
opacity: 0; | ||
font-size: smaller; | ||
visibility: hidden; | ||
transition: all ease-in-out 0.2s; | ||
} | ||
|
||
.main-item--open + ul { | ||
visibility: visible; | ||
max-height: 400px; | ||
padding-left: 22px; | ||
opacity: 1; | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
|
||
.dropdown > ul > li { | ||
height: 48px; | ||
display: flex; | ||
width: 100%; | ||
font-size: 0.9rem; | ||
align-items: center; | ||
border-left: 2px solid var(--line-color); | ||
} | ||
|
||
.dropdown > ul > li > a { | ||
color: var(--item-non-hover); | ||
padding: 1rem 0.75rem; | ||
height: 2.4rem; | ||
line-height: 2.4rem; | ||
display: flex; | ||
align-items: center; | ||
text-decoration: none; | ||
border-radius: 0.5rem; | ||
margin-left: 1rem; | ||
width: 100%; | ||
} | ||
|
||
.dropdown > ul > li:hover { | ||
color: var(--primary-item); | ||
cursor: pointer; | ||
} | ||
|
||
.dropdown > ul > li:hover > a { | ||
color: var(--primary-item); | ||
background: var(--background-item-hover); | ||
width: 100%; | ||
} | ||
|
||
.expand-icon { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
margin-left: auto; | ||
transform: rotate(90deg); | ||
} | ||
|
||
.main-item--open > .expand-icon { | ||
transform: rotate(-90deg); | ||
} | ||
|
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
Oops, something went wrong.