-
Notifications
You must be signed in to change notification settings - Fork 14
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
Refactor: move <Filter />
component
#2823
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
I shared a suggestion we might want to consider, although not blocking.
|
||
import Filter from '.'; | ||
|
||
export default { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: we might want to follow storybook's guidelines about writing stories.
I think it maximizes expressiveness and minimizes repetition.
export default {
title: 'Components/Filter',
component: Filter,
argTypes: {
options: {/** type, description, control... */},
title: {/** type, description, control... */},
value: {/** type, description, control... */},
onChange: {/** type, description, control... */}
},
render: (args) => {
const [value, setValue] = useState(args.value);
return (
<Filter
title={args.title}
options={args.options}
value={value}
onChange={(newValue) => {
setValue(newValue);
action('onChange')(newValue);
}}
/>
);
}
};
export const Default = {
args: {
title: 'Title',
options: [
'Tony Kekw',
'Chad Carbonara',
'Chuck Amatriciana',
'K.C.O. Pepe',
'Virgin Gricia',
],
value: [],
},
};
export const WithValue = {
args: {
...Default.args,
value: ['Tony Kekw'],
},
};
export const WithMultipleValues = {
args: {
...Default.args,
value: ['Tony Kekw', 'Chad Carbonara'],
},
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, it's indeed better to stick with guidelines. Done in c37218f
Description
The
<Filter />
component has been moved out from the<Table />
component so that it can be used separately.This is a preparatory work in order to enhance the usage of tables in more diversified scenarios.
No changes in the behavior of the component have been introduced (except for the default value).
All references to the component has been updated.