From de4c8f99a80dca2e7662fef0ab6761e76c050e6a Mon Sep 17 00:00:00 2001 From: jeffrey Date: Wed, 28 Mar 2018 18:44:30 -0400 Subject: [PATCH 1/5] nearly complete. need to finish click event. --- components/JavaScript/index.js | 17 ++++++++++ css/index.css | 57 ++++++++++++++++++++++++++++++++++ index.html | 39 ++++++++++++++++++++++- less/Box.less | 18 +++++++++++ less/Section.less | 22 +++++++++++++ less/dropdown.less | 28 +++++++++++++++++ less/index.less | 5 +++ 7 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 components/JavaScript/index.js create mode 100644 css/index.css create mode 100644 less/Box.less create mode 100644 less/Section.less create mode 100644 less/dropdown.less create mode 100644 less/index.less diff --git a/components/JavaScript/index.js b/components/JavaScript/index.js new file mode 100644 index 0000000..aa297f0 --- /dev/null +++ b/components/JavaScript/index.js @@ -0,0 +1,17 @@ +class Dropdown { + constructor(element) { + this.element = element; + } + + dropdownOptions() { + this.element.addEventListener('click', function() { + document.querySelector('.Dropdown__options--click').style.display = 'relative'; + }); + } + +} + +const address = document.querySelector('.Box__header--dropdown'); +const dropdown = new Dropdown(address); + +dropdown.dropdownOption(); \ No newline at end of file diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..18158e9 --- /dev/null +++ b/css/index.css @@ -0,0 +1,57 @@ +body { + width: 100%; + max-width: 1024px; + margin: auto; +} +.container { + border: 2px solid black; +} +.Box__header--headline { + position: relative; + text-align: center; +} +.Dropdown { + position: absolute; + margin-left: 2%; +} +.Dropdown__button { + position: absolute; + border: 2px solid black; + background-color: white; + padding: 13px; + font-weight: bold; +} +.Dropdown__options--click { + position: absolute; + display: none; + flex-direction: column; + margin-top: 60px; + border: 2px solid black; + width: 96px; + background-color: white; +} +.Dropdown__options--click a { + margin: 5px; + padding-left: 10px; +} +.Section { + border: 1px solid black; + display: flex; +} +.Section .Section__subSection--left { + display: flex-column; + padding: 0 2%; + border-right: 2px solid black; + border-top: 2px solid black; +} +.Section .Section__subSection--right { + display: flex-column; + padding: 0 2%; + border-left: 2px solid black; + border-top: 2px solid black; +} +@media (max-width: 400px) { + .Section { + flex-direction: column; + } +} diff --git a/index.html b/index.html index 39167c5..77cb40e 100644 --- a/index.html +++ b/index.html @@ -1,9 +1,46 @@ + Introduction to the DOM - + + +
+ +
+ + +
+

Header

+
+
+ +
+
+

Placeholder

+

+ 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. +

+
+
+

Placeholder

+

+ 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. +

+
+
+ +
+ +
\ No newline at end of file diff --git a/less/Box.less b/less/Box.less new file mode 100644 index 0000000..cdc2a24 --- /dev/null +++ b/less/Box.less @@ -0,0 +1,18 @@ +body { + width: 100%; + max-width: 1024px; + margin: auto; +} + +.container { + border: 2px solid black; +} + +.Box__header { + +} + +.Box__header--headline { + position: relative; + text-align: center; +} \ No newline at end of file diff --git a/less/Section.less b/less/Section.less new file mode 100644 index 0000000..b8f9227 --- /dev/null +++ b/less/Section.less @@ -0,0 +1,22 @@ +.Section { + border: 1px solid black; + display: flex; + + .Section__subSection--left { + display: flex-column; + padding: 0 2%; + border-right: 2px solid black; + border-top: 2px solid black; + } + + .Section__subSection--right { + display: flex-column; + padding: 0 2%; + border-left: 2px solid black; + border-top: 2px solid black; + } + + @media @phone { + flex-direction: column; + } +} \ No newline at end of file diff --git a/less/dropdown.less b/less/dropdown.less new file mode 100644 index 0000000..6169a7b --- /dev/null +++ b/less/dropdown.less @@ -0,0 +1,28 @@ +.Dropdown { + position: absolute; + margin-left: 2%; +} + +.Dropdown__button { + position: absolute; + border: 2px solid black; + background-color: white; + padding: 13px; + font-weight: bold; +} + +.Dropdown__options--click { + position: absolute; + display: none; + flex-direction: column; + margin-top: 60px; + border: 2px solid black; + width: 96px; + background-color: white; + + a { + margin: 5px; + padding-left: 10px; + } +} + diff --git a/less/index.less b/less/index.less new file mode 100644 index 0000000..410bfa0 --- /dev/null +++ b/less/index.less @@ -0,0 +1,5 @@ +@phone: ~'(max-width: 400px)'; + +@import "Box"; +@import "dropdown"; +@import "Section"; \ No newline at end of file From 4cf773dbe1f1a28a8745057a9674da4af635b828 Mon Sep 17 00:00:00 2001 From: jeffrey Date: Wed, 28 Mar 2018 18:53:46 -0400 Subject: [PATCH 2/5] removed some files that werent being used --- components/Box/Box.css | 0 components/JavaScript/index.js | 17 ----------------- components/Section/Section.css | 0 index.html | 3 +-- index.js | 21 +++++++++++++++++++++ 5 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 components/Box/Box.css delete mode 100644 components/JavaScript/index.js delete mode 100644 components/Section/Section.css create mode 100644 index.js diff --git a/components/Box/Box.css b/components/Box/Box.css deleted file mode 100644 index e69de29..0000000 diff --git a/components/JavaScript/index.js b/components/JavaScript/index.js deleted file mode 100644 index aa297f0..0000000 --- a/components/JavaScript/index.js +++ /dev/null @@ -1,17 +0,0 @@ -class Dropdown { - constructor(element) { - this.element = element; - } - - dropdownOptions() { - this.element.addEventListener('click', function() { - document.querySelector('.Dropdown__options--click').style.display = 'relative'; - }); - } - -} - -const address = document.querySelector('.Box__header--dropdown'); -const dropdown = new Dropdown(address); - -dropdown.dropdownOption(); \ No newline at end of file diff --git a/components/Section/Section.css b/components/Section/Section.css deleted file mode 100644 index e69de29..0000000 diff --git a/index.html b/index.html index 77cb40e..bd27831 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,6 @@ MDN -

Header

@@ -41,6 +40,6 @@

Placeholder

- + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..69a4e10 --- /dev/null +++ b/index.js @@ -0,0 +1,21 @@ +class Dropdown { + constructor(element) { + this.element = element; + + this.element.addEventListener('click', function() { + document.querySelector('.Dropdown__options--click').style.display = 'relative'; + }); + } + + // dropdownOptions() { + // this.addEventListener('click', function() { + // document.querySelector('.Dropdown__options--click').style.display = 'relative'; + // }); + // } + +} + +const address = document.querySelector('.Dropdown__button'); +const dropdown = new Dropdown(address); + +dropdown(); \ No newline at end of file From a9419ef13ced678febd2142dac49df7f4dd7587d Mon Sep 17 00:00:00 2001 From: jeffrey Date: Wed, 28 Mar 2018 20:48:47 -0400 Subject: [PATCH 3/5] discrepency between visual and actual sizes of the button --- css/index.css | 8 +++++++- index.html | 2 +- index.js | 50 ++++++++++++++++++++++++++++++++++++---------- less/dropdown.less | 9 ++++++++- 4 files changed, 55 insertions(+), 14 deletions(-) diff --git a/css/index.css b/css/index.css index 18158e9..0cf26c9 100644 --- a/css/index.css +++ b/css/index.css @@ -21,9 +21,15 @@ body { padding: 13px; font-weight: bold; } +.Dropdown__hidden { + display: none; +} +.Dropdown__hidden a { + display: none; +} .Dropdown__options--click { position: absolute; - display: none; + display: flex; flex-direction: column; margin-top: 60px; border: 2px solid black; diff --git a/index.html b/index.html index bd27831..47c030d 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@