Skip to content
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
5 changes: 5 additions & 0 deletions components/Box/Box.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.Box__title {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 15px;
}
30 changes: 30 additions & 0 deletions components/Dropdown/Dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.Dropdown {
z-index: 5;
display: inline-block;
position: absolute;
}

.Dropdown__button {
padding: 15px;
background-color: white;
border: 2.5px solid black;
cursor: pointer;
}

.Dropdown__content {
position: absolute;
background-color: white;
display: none;
margin-top: 10px;
padding: 15px;
border: 2.5px solid black;
}

Dropdown__link {
display: inline-block;
margin-bottom: 10px;
}

.Dropdown--active .Dropdown__content{
display: block;
}
15 changes: 15 additions & 0 deletions components/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let dropdown = document.querySelector('.Dropdown');

class Dropdown {
constructor(element) {
this.element = element;
this.element.addEventListener('click', () => {this.toggleDropdown()})
}
toggleDropdown(){
this.element.classList.toggle('Dropdown--active')
}
}

dropdown = new Dropdown(dropdown);

console.log(dropdown);
30 changes: 30 additions & 0 deletions components/Section/Section.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.Section {
box-sizing:border-box;
display: inline-block;
clear: both;
width: 100%;
margin: 0;
padding: 20px;
position: relative;
}

.Section--bordered {
border: 2.5px solid black;
border-top: none;
}

.Section__header {
text-align: center;
font-size: 2.5rem;
font-weight: bold;
}

.Section--half{
width: 50%;

}
body {
box-sizing: border-box;
min-width: 300px;
margin: 0;
}
29 changes: 28 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,32 @@
<link rel="stylesheet" href="./styles.css">
</head>
<body>
</body>
<script defer="defer" src="./components/Dropdown/Dropdown.js"></script>
<div class="Section Section--bordered">
<div class="Dropdown">
<div class="Dropdown__button">Dropdown</div>
<div class="Dropdown__content">
<a class="Dropdown__link" href="https://lambdaschool.com/">Lambda</a>
<a class="Dropdown__link" href="https://google.com/">Google</a>
<a class="Dropdown__link" href="https://developer.mozilla.org/en-US/">MDN</a>
</div>
</div>
<div class="Section__header">Header</div>
</div>
<div class="Section Section--bordered Section--half">
<div class="Box">
<div class="Box__title">Placeholder</div>
<div class="Box__description">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div><div class="Section Section--bordered Section--half">
<div class="Box">
<div class="Box__title">Placeholder</div>
<div class="Box__description">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
</body>
</hml>
Empty file added index.js
Empty file.
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import './components/Section/Section.css';
@import './components/Box/Box.css';
@import './components/Dropdown/Dropdown.css';

body {
box-sizing: border-box;
Expand Down