Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

MVP complete :dab: #1

Merged
merged 1 commit into from
Feb 16, 2019
Merged
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
10 changes: 6 additions & 4 deletions components/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ class Dropdown {
constructor(element) {

// Assign this.element to the dropdown element
this.element;
this.element = element;

// Get the element with the ".dropdown-button" class found in the dropdown element (look at the HTML for context)
this.button = this.element.querySelector();
this.button = this.element.querySelector('.dropdown-button');

// assign the reference to the ".dropdown-content" class found in the dropdown element
this.content;
this.content = this.element.querySelector('.dropdown-content')

// Add a click handler to the button reference and call the toggleContent method.
this.button.addEventListener('click', () => {

this.toggleContent();
})
}

toggleContent() {

// Toggle the ".dropdown-hidden" class off and on
this.content;
this.content.classList.toggle('dropdown-hidden'); // I was almost tricked again!
console.log('im working');
}
}

Expand Down
29 changes: 15 additions & 14 deletions components/Tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,51 @@
class TabLink {
constructor(element) {
// Assign this.element to the passed in DOM element
// this.element;
this.element = element;

// Get the custom data attribute on the Link
// this.data;
this.data = element.dataset.tab;;

// Using the custom data attribute get the associated Item element
// this.itemElement;
this.itemElement = document.querySelector(`.tabs-item[data-tab='${this.data}']`)

// Using the Item element, create a new instance of the TabItem class
// this.tabItem;
this.tabItem = new TabItem(this.itemElement);


// Add a click event listener on this instance, calling the select method on click

this.element.addEventListener('click', () => this.select());
};

select() {
// Get all of the elements with the tabs-link class
// const links;
const links = document.querySelectorAll('.tabs-link');

// Using a loop or the forEach method remove the 'tabs-link-selected' class from all of the links
// Array.from(links).forEach();
links.forEach(link => link.classList.remove('tabs-link-selected'));

// Add a class named "tabs-link-selected" to this link
// this.element;
this.element.classList.add('tabs-link-selected');

// Call the select method on the item associated with this link

this.tabItem.select(this.itemElement);
}
}

class TabItem {
constructor(element) {
// Assign this.element to the passed in element
// this.element;
this.element = element;
}

select() {
// Select all ".tabs-item" elements from the DOM
// const items;
const items = document.querySelectorAll('.tabs-item');

// Remove the class "tabs-item-selected" from each element

items.forEach(item => item.classList.remove('tabs-item-selected'));
// Add a class named "tabs-item-selected" to this element
//this.element;
this.element.classList.add('tabs-item-selected');
}
}

Expand All @@ -59,4 +60,4 @@ class TabItem {

*/

links = document.querySelectorAll();
links = document.querySelectorAll('.tabs-link').forEach(link => new TabLink(link));
126 changes: 126 additions & 0 deletions css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.dropdown {
z-index: 2;
position: absolute;
left: 25px;
cursor: pointer;
}
.dropdown .dropdown-button {
padding: 15px;
border: 3px solid #ffffff;
color: #ffffff;
font-size: 20px;
font-weight: bold;
}
.dropdown .dropdown-button:hover {
background-color: #be2530;
}
.dropdown .dropdown-content {
width: 100%;
position: absolute;
background-color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 10px;
border: 2.5px solid #931d25;
}
.dropdown .dropdown-link {
width: 100%;
text-align: center;
padding: 15px 0;
font-size: 18px;
text-decoration: none;
color: #931d25;
}
.dropdown .dropdown-link:hover {
color: #ffffff;
background-color: #931d25;
}
.dropdown .dropdown-hidden {
display: none;
}
.tabs {
width: 100%;
}
.tabs .tabs-items {
width: 100%;
height: 300px;
display: flex;
justify-content: center;
padding-top: 60px;
}
.tabs .tabs-item {
display: none;
width: 75%;
}
.tabs .tabs-item .tabs-item-title {
font-size: 24px;
font-weight: bold;
padding-bottom: 10px;
}
.tabs .tabs-item-selected {
display: block;
}
.tabs .tabs-links {
display: flex;
background-color: #931d25;
}
.tabs .tabs-link {
padding: 20px 25px;
font-size: 24px;
background-color: #931d25;
border-right: 1px solid white;
color: #ffffff;
cursor: pointer;
}
.tabs .tabs-link:hover {
background-color: #be2530;
}
.tabs .tabs-link-selected {
z-index: 2;
border-right: 1px solid #931d25;
background-color: #ffffff;
color: black;
}
.tabs .tabs-link-selected:hover {
background-color: #ffffff;
}
body {
box-sizing: border-box;
min-width: 300px;
margin: 0;
}
.header-container {
width: 100%;
height: 70px;
border-bottom: 1px solid #ffffff;
display: flex;
justify-content: center;
align-items: center;
background-color: #931d25;
}
.header-container .header {
height: 50px;
}
.section {
width: 70%;
margin: 45px auto;
display: flex;
border: 1px solid #931d25;
box-shadow: 1px 1px 5px #931d25;
border-radius: 10px;
overflow: hidden;
}
.section .box {
padding: 40px;
}
.section .box .box-title {
font-size: 24px;
padding-bottom: 10px;
font-weight: bold;
}