Skip to content

Conversation

@HTLuff
Copy link

@HTLuff HTLuff commented Jun 18, 2018

  • Lastest Tech News button
  • Invert colours button
  • Hide/Show description button

const appScreen = document.querySelector('#app');
const descriptionToggle = document.querySelector('#descrption-toggle');

function createURL(indvCategory){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like the helper function use

return `https://newsapi.org/v2/top-headlines?category=technology&country=gb&apiKey=${newAPIKey}&pagesize=5`;
}

function display(newsData){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display logic nicely broken out into own function

const newsDesc = Array.from(document.getElementsByClassName('news-desc'));
if(descriptionToggle.className.match(/(?:|\s) toggle-on(?!\s)/)){
newsDesc.forEach(function(el){
el.className = el.className.replace(' toggle-on', '');
Copy link
Contributor

@dmitrigrabov dmitrigrabov Jul 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

.clicked {
filter: invert(100%);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants