-
Notifications
You must be signed in to change notification settings - Fork 109
Tylar Pierson #66
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
Open
tylarpierson
wants to merge
13
commits into
bloominstituteoftechnology:master
Choose a base branch
from
tylarpierson:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tylar Pierson #66
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
109efef
added the boxes html with BEM naming
tylarpierson 47e5e63
added styles to the boxes in box.css
tylarpierson d1c7faf
got box2 to line up with header box and gave header a box border
tylarpierson 87f238f
changed dropdown from h3 to p and center header text
tylarpierson ef47176
added dropdown folder and file in components folder, changed some styles
tylarpierson 77dab89
imported dropdown to styles.css
tylarpierson 6f12160
changed header spacing with dropdown
tylarpierson 2db22f9
fixed styling for dropdown box
tylarpierson e66d5ae
fixed folder structore in components folder
tylarpierson 06503ba
working on getting the dropdown menu to work
tylarpierson a79a6b4
figuring out how to get the dropdown menu to work
tylarpierson 3527543
got dropdown menu to work and styled some
tylarpierson 92a8c43
refactored my JS to Dan's example
tylarpierson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| .Box { | ||
| width: 49%; | ||
| height: 200px; | ||
| border: 2px solid black; | ||
| float: left; | ||
| margin-right: 0; | ||
| } | ||
|
|
||
| .Box--2 { | ||
| width: 50%; | ||
| } | ||
|
|
||
| .Box__header { | ||
| margin: 20px; | ||
| } | ||
|
|
||
| .Box__text { | ||
| margin: 20px; | ||
| } |
This file contains hidden or 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,26 @@ | ||
|
|
||
| .Dropdown__button { | ||
| margin-top: 30px; | ||
| align-items: center; | ||
| min-width: 160px; | ||
| height: 30px; | ||
| border: 3px solid black; | ||
| padding-left: 12px; | ||
| padding-top: 5px; | ||
| padding-right: 0; | ||
| position: absolute; | ||
| } | ||
|
|
||
| .Dropdown__Menu { | ||
| visibility: hidden; | ||
| list-style: none; | ||
| } | ||
|
|
||
| .Dropdown__Menu li { | ||
| border: 1px solid black; | ||
| background-color: #F9F9F9; | ||
| } | ||
|
|
||
| .show { | ||
| visibility: visible; | ||
| } |
This file contains hidden or 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,35 @@ | ||
| // function myFunction() { | ||
| // document.getElementById('myDropdown').classList.toggle('show') | ||
| // } | ||
| // let button = document.querySelector('.Dropdown__button') | ||
| // button.onclick = function(event) { | ||
| // let dropdowns = document.getElementById('myDropdown') | ||
| // console.log(dropdowns) | ||
| // dropdowns.classList.toggle('show') | ||
| // } | ||
|
|
||
| //Refactoring my JS to match what Dan did | ||
|
|
||
| class Dropdown { | ||
| constructor(element, hideClass) { | ||
| this.element = element, | ||
| this.clicked = false, | ||
| this.child = [...this.element.children].find(child => child.className === hideClass), | ||
| this.element.addEventListener('click', () => this.handleClickEvent()) | ||
| } | ||
|
|
||
| // display hidden menu | ||
| handleClickEvent() { | ||
| if (this.clicked && this.child.classList)this.child.classList.remove('display') | ||
| else this.child.classList.add('show') | ||
| this.toggleDropdown() | ||
| } | ||
|
|
||
| // toggle allows the event to turn on/off | ||
| toggleDropdown() { | ||
| this.clicked = !this.clicked | ||
| } | ||
| } | ||
|
|
||
| // const must be at the bottom in the 'new Class' format | ||
| const dropdown = new Dropdown(document.querySelector('.Dropdown'), 'Dropdown__Menu') | ||
This file contains hidden or 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 @@ | ||
| .Header { | ||
| display: flex; | ||
| border: 2px solid black; | ||
| height: 80px; | ||
| justify-content: space-evenly; | ||
| flex-direction: row-reverse; | ||
| } | ||
|
|
||
| .Header__headline { | ||
| margin-right: 45%; | ||
| margin-left: 400px; | ||
| } | ||
|
|
||
|
|
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,47 @@ | ||
| <!DOCTYPE html> | ||
| <hml> | ||
| <html> | ||
| <head> | ||
| <title>Introduction to the DOM</title> | ||
| <link rel="stylesheet" href="./styles.css"> | ||
| <link rel="stylesheet" href="./styles.css"> | ||
| </head> | ||
| <body> | ||
| <div class="Header"> | ||
| <script src="components/Dropdown/index.js" async></script> | ||
| <h1 class="Header__headline">Header</h1> | ||
| <div class="Dropdown"> | ||
| <h4 class="Dropdown__button">Dropdown</h4> | ||
| <ul id="myDropdown" class="Dropdown__Menu"> | ||
| <li><a href="https://lambdaschool.com/">Lambda School</a></li> | ||
| <li><a href="https://www.google.com/">Google</a></li> | ||
| <li><a href="https://developer.mozilla.org/en-US/">MDN</a></li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| <div class="Box"> | ||
| <div class="Box__header"> | ||
| <h3 class="Box__headerHeadline">Placeholder</h2> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can make thing look something like
|
||
| </div> | ||
| <div class="Box__text"> | ||
| <p class="Box__textParagraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
| Fusce risus nibh, gravida nec felis quis, facilisis facilisis lectus. Nulla ac orci pretium, | ||
| condimentum orci quis, accumsan nisi. Aliquam erat volutpat. Curabitur cursus mattis libero, | ||
| at viverra risus hendrerit quis. Fusce imperdiet tristique tortor non tincidunt. Mauris accumsan | ||
| urna nec augue feugiat porta. Proin vitae magna in ex malesuada laoreet eget a nulla. Aliquam tristique | ||
| et elit at consequat. In hac habitasse platea dictumst.</p> | ||
| </div> | ||
| </div> | ||
| <div class="Box Box--2"> | ||
| <div class="Box__header"> | ||
| <h3 class="Box__headerHeadline">Placeholder</h3> | ||
| </div> | ||
| <div class="Box__text"> | ||
| <p class="Box__textParagraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
| Fusce risus nibh, gravida nec felis quis, facilisis facilisis lectus. Nulla ac orci pretium, | ||
| condimentum orci quis, accumsan nisi. Aliquam erat volutpat. Curabitur cursus mattis libero, | ||
| at viverra risus hendrerit quis. Fusce imperdiet tristique tortor non tincidunt. Mauris accumsan | ||
| urna nec augue feugiat porta. Proin vitae magna in ex malesuada laoreet eget a nulla. Aliquam tristique | ||
| et elit at consequat. In hac habitasse platea dictumst.</p> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </hml> | ||
| </html> | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thought process here! I would have also probably used the toggle method as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, thank you for commenting out your prior work! I love seeing you progress and make changes. 🔥