Skip to content

Commit

Permalink
Change background colors when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-tran committed Jan 20, 2019
1 parent ab7ebfa commit e33e2ff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
22 changes: 22 additions & 0 deletions feelsbook/feelsbook/src/components/WritePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ class WritePage extends Component {
} else {
console.log('tone endpoint:');
console.log(JSON.stringify(tone, null, 2));
console.log('length: ' + tone.document_tone.tones.length);
for (var i = 0; i < tone.document_tone.tones.length; i++) {
var tone_id = tone.document_tone.tones[i].tone_id;
console.log("mood: " + tone.document_tone.tones[i]);
console.log("Tone score: " + tone.document_tone.tones[i].score);
console.log("Tone id: " + tone.document_tone.tones[i].tone_id);
if (tone_id === 'anger') {
document.body.style.backgroundColor = "red";
} else if (tone_id === 'fear') {
document.body.style.backgroundColor = "black";
} else if (tone_id === 'joy') {
document.body.style.backgroundColor = "yellow";
} else if (tone_id === 'sadness') {
document.body.style.backgroundColor = "blue";
} else if (tone_id === 'analytical') {
document.body.style.backgroundColor = "teal";
} else if (tone_id === 'confident') {
document.body.style.backgroundColor = "orange";
} else if (tone_id === 'tentative') {
document.body.style.backgroundColor = "pink";
}
}
}
}
);
Expand Down
6 changes: 3 additions & 3 deletions feelsbook/feelsbook/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: #f2709c; /* fallback for old browsers */
background: -webkit-linear-gradient(to left, #ff9472, #f2709c); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to left, #ff9472, #f2709c); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
background: white; /* fallback for old browsers */
/* background: -webkit-linear-gradient(to left, #ff9472, #f2709c);
background: linear-gradient(to left, #ff9472, #f2709c); */
}

code {
Expand Down

0 comments on commit e33e2ff

Please sign in to comment.