Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update <Site> component to use ES6 syntax. #3338

Merged
merged 2 commits into from
Mar 26, 2016
Merged

Conversation

mtias
Copy link
Member

@mtias mtias commented Feb 16, 2016

No description provided.

@mtias mtias added Sites [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Components [Type] Janitorial labels Feb 16, 2016
classNames = require( 'classnames' ),
noop = require( 'lodash/utility/noop' );
import React from 'react';
import classnames from 'classnames';
Copy link
Contributor

Choose a reason for hiding this comment

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

are you avoiding camelCase on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's necessary here.

@retrofox
Copy link
Contributor

BTW I got these eslint warning

image

it comes from eslint-plugin-react module.

My suggestion:

const setStartToottip = startTooltip => this.setState( { startTooltip } );

return (
  <button
    className="site__star"
    onClick={ this.starSite }
    onMouseEnter={ setStartTooltip( true ) }
    onMouseLeave={ setStartTooltip( false ) }
    // ...

@gwwar
Copy link
Contributor

gwwar commented Mar 26, 2016

If we're bothering to work around the warning I'd suggest doing it properly. Basically we don't want to create functions in a render method. One way to fix this would be to add:

enableStarTooltip() {
    this.setState( { starTooltip: true } );
},
disableStarTooltip() {
    this.setState( { starTooltip: false } );
},
render() {
   return ( <button onMouseEnter={ this.enableStarTooltip } onMouseLeave={ this.disableStarTooltip } /> );
}

@gwwar
Copy link
Contributor

gwwar commented Mar 26, 2016

👍 changes look good to 🚢 after a rebase

@gwwar gwwar added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 26, 2016
@blowery blowery added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Ready to Merge labels Mar 26, 2016
@blowery
Copy link
Contributor

blowery commented Mar 26, 2016

@gwwar Marking this back as Needs Review since I rebased it and added the bound methods to get rid of the JSX-bind linting warnings.

const site = this.props.site;
sites.toggleStarred( site.ID );
},

renderStar: function() {
enableStarTooltip() {
this.setState( { starTooltip: true } )
Copy link
Contributor

Choose a reason for hiding this comment

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

; ?

@gwwar
Copy link
Contributor

gwwar commented Mar 26, 2016

🚢 after adding in the missing ;

@gwwar gwwar added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 26, 2016
@blowery
Copy link
Contributor

blowery commented Mar 26, 2016

@gwwar nice catch! fixed in an amended commit.

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

Successfully merging this pull request may close these issues.

None yet

5 participants