Skip to content

Conversation

@jeff-phillips-18
Copy link
Member

import React from 'react';
import PropTypes from 'prop-types';

class Filter extends React.Component {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Thanks.

}

let menuId = 'filterCategoryMenu';
menuId += id ? '_' + id : '';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a template literal with backticks... think there are a couple of these

menuId += id ? `_${id}` : ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks.

@priley86
Copy link
Member

priley86 commented Dec 20, 2017

@jeff-phillips-18 much closer here...

Here is a few suggested changes: priley86@4d9ab63

I am not positive, but you may be able to convert them all to stateless if just using conditional rendering inline vs event handlers on a class (seems it works OK but please test). Reason being here, those event handlers actually cause a minor degradation in performance. https://javascriptplayground.com/blog/2017/03/functional-stateless-components-react/

Also... it would nice to have the added intellisense for sub-classed components (added example there).

Nice job! I think this refactor is much more clear from a consumer perspective, however it is still a bit opinionated as far as how the logic works (not used to typically seeing this much logic in some of the components here, but this one is a bit "higher level" though). This could still be a good generalization though depending on how much you see it being used in downstream apps. Many of inner most components are now using our more basic elements and I think it is nice to have the Filter component for rendering those PF classes/divs. This is a good example of a "higher order" complex component for handling multiple form fields in a stateless manner.

FilterCategorySelector,
FilterCategoryValueSelector
} from '../../../index';
import { boolean } from '@storybook/addon-knobs/dist/index';
Copy link
Member

Choose a reason for hiding this comment

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

This is throwing an error for me in the console...

Suggestion is to move the boolean up to the Filter.stories.js file and pass it down as a prop to the MockFilterExample. I tend to define all the Knobs on the *.stories.js file, but that is just preference...makes it easier to copy/paste those imports...

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've removed the need for the import.

@jeff-phillips-18
Copy link
Member Author

Updated to stateless and added intellisense for all sub-classed components

@jeff-phillips-18
Copy link
Member Author

Simplified storybook stories.

@priley86
Copy link
Member

priley86 commented Jan 4, 2018

this looks to good me. I am assuming the next step is to test integrating this w/ data tables/list view/etc. For data tables, we should be able to search the rows in the resolved rows/recompose methods (just how we did sort/paging). Adding the filters should work but will have to test it...

@jeff-phillips-18
Copy link
Member Author

Yeah, this will need to be integrated into the views by the application. We can add controlled versions of list view, data tables, etc as we see fit.

@jeff-phillips-18
Copy link
Member Author

The less/sass files here will not be needed as these selectors have been added to PF core. I will update the PF version and test, then update this PR.

@jeff-phillips-18
Copy link
Member Author

Updated to patternfly 3.35.0 and removed filter specific less/sass

Copy link
Member

@cdcabrera cdcabrera left a comment

Choose a reason for hiding this comment

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

@jeff-phillips-18 are the constants used anymore, or they left over?

@jeff-phillips-18
Copy link
Member Author

@cdcabrera correct, thanks. I've removed it.

cdcabrera
cdcabrera previously approved these changes Jan 4, 2018
Copy link
Member

@cdcabrera cdcabrera left a comment

Choose a reason for hiding this comment

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

Aside from a minor rebase, and a bit of repetition, something we can improve upon down the road looking good.

I'm up for iterative changes on this

@priley86
Copy link
Member

priley86 commented Jan 4, 2018

yep aside from the inputs I'm fine with this and would like to test integration. We can rebase those with <FormControl type="text" later on after #131 is in.

good to merge here 😉

@priley86 priley86 merged commit 71af8ae into patternfly:master Jan 4, 2018
@jeff-phillips-18 jeff-phillips-18 deleted the filter branch March 13, 2018 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component - Filter

4 participants