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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 20408
}
64 changes: 64 additions & 0 deletions Article/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,67 @@ const data = [
Step 5: Add a new article to the array. Make sure it is in the same format as the others. Refresh the page to see the new article.

*/

//1



function createArticle(title, date, firstParagraph, secondParagraph, thirdParagraph) {
const article = document.createElement('div');
const articleTitle = document.createElement('h2');
const articleDate = document.createElement('p');
const paragraph1 = document.createElement('p');
const paragraph2 = document.createElement('p');
const paragraph3 = document.createElement('p');
const button = document.createElement('span');



article.appendChild(articleTitle);
article.appendChild(articleDate);
article.appendChild(paragraph1);
article.appendChild(paragraph2);
article.appendChild(paragraph3);
article.appendChild(button);

articleTitle.textContent = title;
articleDate.textContent = date;
paragraph1.textcontent = firstParagraph;
paragraph2.textContent = secondParagraph;
paragraph3.textContent = thirdParagraph;
button.textContent = 'click here'

article.classList.add('article');
articleDate.classList.add('date');
button.classList.add('expandButton');

button.addEventListener('click', event => {
article.classList.toggle('article-open');


});


return article;



}





console.log(createArticle);

//-----Append Manual and Loop------
const body = document.querySelector('body');
console.log(body);


// Append Loop
data.forEach((article => {
body.append(createArticle(article.title, article.date, article.firstParagraph, article.secondParagraph, article.thirdParagraph));
}))


2 changes: 1 addition & 1 deletion LESS/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* Below this line is where you will start your work */
/* It is important to note, you will not be writing any CSS in this file*/
@import '../Header/Header.less';

@import '../Article/Article.less';
html, body {
margin: 0;
padding: 0;
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ In this project we are going to be building a news feed reader. The goal is to h

**Follow these steps to set up and work on your project:**

* [ ] Create a forked copy of this project.
* [ ] Add your team lead as collaborator on Github.
* [ ] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [ ] Create a new branch: git checkout -b `<firstName-lastName>`.
* [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [x] Create a forked copy of this project.
* [x] Add your team lead as collaborator on Github.
* [x] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [x] Create a new branch: git checkout -b `<firstName-lastName>`.
* [x] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [ ] Push commits: git push origin `<firstName-lastName>`.

**Follow these steps for completing your project.**
Expand Down
85 changes: 85 additions & 0 deletions css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* This line is importing the font 'Roboto'. DO NOT change line 2*/
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src: local('Roboto Italic'), local('Roboto-Italic'), url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1Mu51xIIzc.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxP.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc9.ttf) format('truetype');
}
/* Below this line is where you will start your work */
/* It is important to note, you will not be writing any CSS in this file*/
.header {
width: 100%;
height: 75px;
background-color: #388E3C;
color: white;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
z-index: 2;
}
.header h1 {
margin: 0;
font-size: 48px;
}
.articles {
margin-top: 95px;
}
.article {
margin: 20px 10%;
padding: 0 20px 25px;
border: 1px solid lightgrey;
border-radius: 10px;
background-color: white;
position: relative;
height: 50px;
overflow: hidden;
box-shadow: 2px 2px 2px lightgrey;
}
.article h2 {
font-size: 28px;
padding: 0;
margin: 15px 0 0;
}
.article .date {
margin: 0;
font-size: 14px;
}
.article .close {
position: absolute;
top: 10px;
right: 10px;
}
.article .expandButton {
position: absolute;
bottom: 0;
left: 50%;
font-size: 12px;
color: grey;
cursor: pointer;
transform: translate(-50%);
background-color: white;
}
.article-open {
height: 400px;
}
html,
body {
margin: 0;
padding: 0;
font-family: 'Roboto';
background-color: #fffef7;
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<div class="header">
<img class="menu-button" src="./assets/menu.png"/>
<h1>Lambda School Newsfeed</h1>
<h1>Lambda Schooooool Newsfeed</h1>
</div>
<div class="articles"></div>
</body>
Expand Down