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
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ FROM node:6
COPY . /code
WORKDIR /code

RUN yarn install

CMD node .
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const inlineStyles = {
},
};

class RefactoTarget extends Component {
export class RefactoTarget extends Component {

state = {
buttonMarginLeft: 'Opx',
Expand Down
1 change: 1 addition & 0 deletions client/source/containers/refacto-target/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './refacto-target.container';
16 changes: 16 additions & 0 deletions client/source/containers/refacto-target/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import renderer from 'react-test-renderer';

import RefactoTarget from './refacto-target.component';

describe('[Containers] <RefactoTarget />', () => {
const props = {
mainActions: {
doStuff: () => {},
doSomething: () => {},
},
main: 'BONJOUR',
};
const refactoTarget = renderer.create(<RefactoTarget {...props} />);
expect(refactoTarget.toJSON()).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React, { Component, PropTypes } from 'react';
import style from 'refacto-target.style.css';

export default class RefactoTarget extends Component {

state = {
buttonMarginLeft: 'Opx',
buttonMarginTop: 'Opx',
displayTextBubble: false,
}

getRandomMargin = () => (
Math.floor((Math.random() * 400) + 1)
)

blink = () => {
this.setState({
buttonMarginLeft: `${this.getRandomMargin()}px`,
buttonMarginTop: `${this.getRandomMargin()}px`,
});
};

stopIt = () => {
this.setState({ displayTextBubble: true });
this.props.mainActions.doStuff('Nice catch!');
setTimeout(() => {
this.props.mainActions.doSomething();
this.setState({ displayTextBubble: false });
}, 2000);
};

render() {
return (
<div className={style.container}>
{this.props.main}
<div className={style.button_container}>
<div
className={style.button_wrapper}
style={{
marginLeft: this.state.buttonMarginLeft,
marginTop: this.state.buttonMarginTop,
}}
onMouseOver={this.blink}
>
<button
onClick={this.stopIt}
className={style.main_button}
>
Main Button
{ this.state.displayTextBubble ?
(<div className={style.text_bubble}>
Stop It !
<div className={style.bubble_binder}>
{ }
</div>
</div>)
: (null)
}
</button>
</div>
</div>
</div>
);
}
}

RefactoTarget.propTypes = {
mainActions: PropTypes.shape({
doStuff: PropTypes.func.isRequired,
doSomething: PropTypes.func.isRequired,
}),
main: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import RefactoTarget from 'refacto-target.component';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import * as MainActions from '../../actions/main';

function mapStateToProps(state) {
return {
main: state.main,
};
}

function mapDispatchToProps(dispatch) {
return {
mainActions: bindActionCreators(MainActions, dispatch),
};
}

export default connect(
mapStateToProps,
mapDispatchToProps,
)(RefactoTarget);
33 changes: 33 additions & 0 deletions client/source/containers/refacto-target/refacto-target.style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.container {
margin: 10px;
position: relative;
text-align: center;
}
.button_container {
height: 100vh;
}
.button_wrapper {
padding: 40px;
transition: margin 800ms cubic-bezier(0.23, 13, 0.323, 1) 100ms;
}
.text_bubble {
position: absolute;
top: -30px;
left: 10px;
font-size: 15px;
width: 60px;
border-radius: 3px;
background-color: #EEE;
}
.bubble_binder {
border-width: 0 0 12px 13px;
border-style: solid;
border-color: transparent #EEE;
top: 17px;
left: 10px;
position: absolute;
}
.main_button {
padding: 5px;
position: relative;
}
16 changes: 16 additions & 0 deletions client/source/containers/refacto-target/refacto-target.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import renderer from 'react-test-renderer';

import RefactoTarget from './refacto-target.component';

describe('[Containers] <RefactoTarget />', () => {
const props = {
mainActions: {
doStuff: () => {},
doSomething: () => {},
},
main: 'BONJOUR',
};
const refactoTarget = renderer.create(<RefactoTarget {...props} />);
expect(refactoTarget.toJSON()).toMatchSnapshot();
});