Guest User

Untitled

a guest
Jun 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. export class CreateActionCard extends React.Component {
  2. state = {
  3. isCreating: this.props.creating || false,
  4. };
  5.  
  6. handleWrapperClick = () => {
  7. this.setState({
  8. isCreating: true,
  9. });
  10. };
  11.  
  12. handleCancelButtonClick = () => {
  13. this.setState({
  14. isCreating: false,
  15. });
  16. };
  17.  
  18. handleSaveButtonClick = (person) => {
  19. this.props.onSaveButtonClick(person);
  20.  
  21. this.setState({
  22. isCreating: false,
  23. });
  24. };
  25.  
  26. render() {
  27. const title = 'Action title';
  28. const date = '12.05.2018';
  29. const description = 'Music fan. Alcohol enthusiast. Creator. Devoted social media geek. Total analyst. Coffee lover. Beer junkie. Coffee maven. Avid alcohol lover. Twitter expert. Lifelong tv ninja. Creator. Passionate tv nerd. Problem solver. Proud alcohol evangelist. Lifelong web junkie. Coffee maven. Unapologetic social media advocate. Analyst. Tv trailblazer. Zombie geek. Twitter aficionado. Reader.';
  30.  
  31. console.log(this.props.creating)
  32.  
  33. return (
  34. <React.Fragment>
  35. {
  36. !this.state.isCreating ?
  37. <Wrapper className={ this.props.className } onClick={ this.handleWrapperClick }>
  38. <Icon icon={ plus }/>
  39. </Wrapper>
  40. :
  41. <ActionCard
  42. title={ title }
  43. date={ date }
  44. description={ description }
  45. karma={ 'neutral' }
  46. create
  47. onCancelButtonClick={ this.handleCancelButtonClick }
  48. onSaveButtonClick={ this.handleSaveButtonClick }
  49. />
  50. }
  51. </React.Fragment>
  52. );
  53. }
  54. }
Add Comment
Please, Sign In to add comment