Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Conversation

lynnmercier
Copy link
Contributor

This is to prepare us for the extended FAB (#127) where we need to accept both an icon and a label as input. Both icon and label will be passed as props to the Fab component

return;
}

return this.addClassesToElement('mdc-fab__icon', icon);
Copy link

Choose a reason for hiding this comment

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

since you only use this addClassesToElement once, I think you should inline the logic:

const updatedProps = {
      className: classnames('mdc-fab__icon', icon.props.className),
    };

    return React.cloneElement(icon, updatedProps);

</button>
);
}

addClassesToElement(classes, element) {
Copy link

Choose a reason for hiding this comment

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

remove this method

Copy link

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

I think you need the mdc-fab--extended class in the get classes method.

Also pushed a change to the screenshot tests. Hope that is ok

@codecov-io
Copy link

codecov-io commented Jul 20, 2018

Codecov Report

Merging #159 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #159   +/-   ##
=======================================
  Coverage   95.78%   95.78%           
=======================================
  Files          21       21           
  Lines         712      712           
  Branches       63       64    +1     
=======================================
  Hits          682      682           
  Misses         30       30
Impacted Files Coverage Δ
packages/fab/index.js 93.33% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8761ba9...d473fa2. Read the comment docs.

</button>
);
}
}

Fab.propTypes = {
mini: PropTypes.bool,
icon: PropTypes.element,
className: PropTypes.string,
children: PropTypes.oneOfType([
Copy link

Choose a reason for hiding this comment

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

remove children from proptypes. I think you're planning on using label or text props instead.

@@ -47,14 +52,15 @@ export class Fab extends React.Component {
className={this.classes}
ref={initRipple}
{...otherProps}>
{this.addIconClassToAllChildren()}
{this.renderIcon()}
Copy link

Choose a reason for hiding this comment

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

comment for line above ^ remove children from list, since you don't use it

return React.cloneElement(item, props);
});
};
renderIcon() {
Copy link

Choose a reason for hiding this comment

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

comment for lines above^

You are not using this.state.classList. Please remove that from state.

@lynnmercier lynnmercier merged commit 1569f97 into master Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants