Skip to content

Commit

Permalink
reposition message and cat
Browse files Browse the repository at this point in the history
  • Loading branch information
Jwhiles committed Feb 2, 2017
1 parent c3fdc8a commit 98451ed
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function setAction(newState, value) {
};
}

function initiateConversation() {
function initiateConversation(value) {
return {
type: INITIATE_CONVERSATION,
status: "message",
value: 1
value: value
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import '../styles/App.css';

class App extends Component {
render() {
const { message, callToAction, updateMessage } = this.props;
const { message, callToAction, updateMessage, initiateConversation } = this.props;
return (
<div className='container'>
{callToAction && <CallToAction {...callToAction} updateMessage={updateMessage}/>}
<Menu />
{message && <Message message={message} updateMessage={updateMessage}/>}
<Cat />
<Cat initiateConversation={initiateConversation} />
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Cat.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';

const Cat = () => {
const Cat = ({ initiateConversation }) => {
return (
<img alt="friendly cat" className="cat" src="./cat.png" />
<img onClick={() => initiateConversation(12)} alt="friendly cat" className="cat" src="./cat.png" />
);
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Message extends React.Component {
render() {
const { message, updateMessage } = this.props;
return (
<div className="message-container">
<div className="message">
<p className="question">{message.text}</p>
{message.responses.map((response, key) =>
Expand All @@ -13,6 +14,7 @@ class Message extends React.Component {
key={ key } />
)}
</div>
</div>
);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const mapDispatchToProps = (dispatch) => {
return {
updateMessage: ({ action, value }) => {
dispatch(actions.setAction(action, value));
},
initiateConversation: (value) => {
dispatch(actions.initiateConversation(value));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/MenuContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mapDispatchToProps = (dispatch) => {
handleEvent: (label) => {
switch(label) {
case 'talk':
dispatch(actions.initiateConversation());
dispatch(actions.initiateConversation(1));
break;
default:
return;
Expand Down
6 changes: 6 additions & 0 deletions src/resources/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,11 @@
{ "text": "That sounds fun!", "action": "message", "value": "6" },
{ "text": "I don't really want to", "action": "message", "value": "8" }
]
},
"12": {
"text": "Meeowww",
"responses": [
{ "text": "awww", "action": "idle", "value": null }
]
}
}
21 changes: 15 additions & 6 deletions src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ body {
position: relative;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#2989d8+0,1e5799+62,207cca+62,c1a666+62,70592b+62,b29f62+100 */
background: #2989d8; /* Old browsers */
background: -moz-linear-gradient(top, #2989d8 0%, #1e5799 62%, #207cca 62%, #c1a666 62%, #70592b 62%, #b29f62 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #2989d8 0%,#1e5799 62%,#207cca 62%,#c1a666 62%,#70592b 62%,#b29f62 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #2989d8 0%,#1e5799 62%,#207cca 62%,#c1a666 62%,#70592b 62%,#b29f62 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
background: -moz-linear-gradient(top, #2989d8 0%, #1e5799 68%, #207cca 68%, #c1a666 68%, #70592b 68%, #b29f62 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #2989d8 0%,#1e5799 68%,#207cca 68%,#c1a666 68%,#70592b 68%,#b29f62 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #2989d8 0%,#1e5799 68%,#207cca 68%,#c1a666 68%,#70592b 68%,#b29f62 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2989d8', endColorstr='#b29f62',GradientType=0 ); /* IE6-9 */
text-align: center;
}

.cat {
position: fixed;
top: 310px;
top: 340px;
left: 75px;
width: 200px;
height: 200px;
Expand All @@ -46,7 +46,7 @@ body {
transform: translate3d(2px, 0, 0);
}

30%, 50%, 70% {
30%, 50%, 68% {
transform: translate3d(-4px, 0, 0);
}

Expand Down Expand Up @@ -83,13 +83,22 @@ body {
top: 1px;
}

.message-container {
box-sizing: border-box;
width: 320px;
height: 300px;
position: fixed;
}

.message {
display: inline-block;
border-radius: 10%;
background-color: white;
padding: 10px;
margin: 60px auto;
width: 250px;
position: relative;
top: 50%;
transform: translateY(-50%);
}

.message .question {
Expand Down

0 comments on commit 98451ed

Please sign in to comment.