Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Remove dependencies of metal-dropdown #146

Merged
merged 5 commits into from
Nov 17, 2017

Conversation

matuzalemsteles
Copy link
Collaborator

This resolves #145.

I just put the metal-dropdown code in clay-dropdown and remove some unnecessary things.

@carloslancha
Copy link
Collaborator

Just started reviewing :)

:octocat: Sent from GH.

Copy link
Collaborator

@carloslancha carloslancha left a comment

Choose a reason for hiding this comment

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

Also, we need to make sure to test all the functionality brought from metal-dropdown.

* @inheritDoc
*/
detached() {
super.attached();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lifecycle methods are just defined in Component, but there's nothing inside. I guess we can get rid of this super call.

https://github.com/metal/metal.js/blob/master/packages/metal-component/src/Component.js#L283

* @inheritDoc
*/
attached() {
super.attached();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lifecycle methods are just defined in Component, but there's nothing inside. I guess we can get rid of this super call.

https://github.com/metal/metal.js/blob/master/packages/metal-component/src/Component.js#L217

[Align.LeftCenter]: 'dropleft',
};
}

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

SF: Method alphabetically ordered

@@ -2,17 +2,153 @@ import 'clay-button';
import 'clay-checkbox';
Copy link
Collaborator

Choose a reason for hiding this comment

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

SF: Order imports alphabetically

expanded: Config.bool().value(false),
expanded: Config.bool()
.value(false)
.internal(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not internal

* @return {!Object}
* @protected
*/
valueClassMapFn_() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

classMap was used in metal-dropdown soy template. Since we're not using this param in our templates we can get rid of this method.

* @type {!Object}
* @default valueClassMapFn_
*/
classMap_: Config.validator(object)
Copy link
Collaborator

Choose a reason for hiding this comment

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

classMap was used in metal-dropdown soy template. Since we're not using this param in our templates we can get rid of this.

*/
syncExpanded(expanded) {
if (expanded && this.alignElementSelector) {
// eslint-disable-next-line
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should try avoiding to disable line linting. In this case we can just split the line in two:

let alignElement = this.element.querySelector(
   this.alignElementSelector);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@carloslancha I had done that, but the prettier is leaving everything inline, had to add to not break in the CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

We merged prettier/prettier-eslint#141 yesterday and a new version of prettier-eslint was auto-released. It should solve the issue.

@matuzalemsteles, can you try updating the dependencies to see if this goes away?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey @jbalsas, it is necessary that prettier-eslint-cli update the version of prettier-eslint to 8.2.2.

Copy link
Contributor

@jbalsas jbalsas Nov 16, 2017

Choose a reason for hiding this comment

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

@Robert-Frampton, could you take care of that? I thought they were synced somehow :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jbalsas for some reason the npm run checkFormat is failing.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's because some files are out of format. See the log:

packages/clay-alert/src/ClayAlert.js
packages/clay-charts/src/ChartBase.js
packages/clay-collapse/src/ClayCollapse.js
packages/clay-dropdown/src/items_validator.js
packages/clay-modal/src/ClayModal.js
packages/clay-collapse/src/__tests__/ClayCollapse.js
packages/clay-navbar/src/__tests__/ClayNavbar.js
success formatting 7 files with prettier-eslint

If you run npm run format locally, would you probably see those changes. The checkFormat task is there to ensure nothing gets committed with the wrong format.

Can you run that and see what's changing? You can run the npm run checkFormat task before sending this over to see if some files need formatting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was due to a yarn upgrade prettier-eslint-cli which upgraded prettier-eslint to 8.2.2 and had to make some changes. So as not to mess up the yarn.lock tree, I think we'd better keep it out of this, until prettier-eslint-cli is using 8.2.2. what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

* @type {string|number}
* @default Align.BottomLeft
*/
position_: Config.setter('setterPositionFn_')
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we set this internal, since we're not setting it anywhere, we don't really need it. Remove this, setterPositionFn_ and validatePosition_ methods and replace line 105 with:

this.alignedPosition_ = Align.align(
 	bodyElement,
 	alignElement,
 	Align.BottomLeft
 );

import Dropdown from 'metal-dropdown';
import Soy from 'metal-soy';
import {Align} from 'metal-position';
import {core, object} from 'metal';
Copy link
Collaborator

Choose a reason for hiding this comment

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

No needed after removing all stuff

@matuzalemsteles
Copy link
Collaborator Author

Hey @carloslancha, Removes the methods that were not being used and changed the way I was adding the click event in the document to be added only when a dropdown is open.

@matuzalemsteles matuzalemsteles force-pushed the remove-dropdown branch 2 times, most recently from 83ba2b0 to 1c39a5c Compare November 16, 2017 17:27
@carloslancha
Copy link
Collaborator

Just started reviewing :)

:octocat: Sent from GH.

@carloslancha carloslancha merged commit 981a629 into deprecate:master Nov 17, 2017
@carloslancha
Copy link
Collaborator

Merged, thx! :)

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.

Remove metal-* UI components dependencies
3 participants