-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add FilterList to TreeDetails page #4
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.
It is working ok, but I noticed some things that could be improved:
- An error happens if i open the filters model, select one and close the modal without filtering it, when i open it again and select other filter it will add the both of them, even though the first one is not selected
- hover clean all state is too light, we cannot read the text
- about status filter: true or false doesn't make sense
- we should check what this refresh button is suppose to do, I don't think this should be there right now
@@ -92,7 +92,7 @@ const FilterList = ({ | |||
[itens, onClickItem], | |||
); | |||
|
|||
if (removeOnEmpty && !itens) { | |||
if (removeOnEmpty && !itens.length) { |
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.
nit: items
if (newFilter[filterField]) { | ||
newFilter[filterField][value] = isSelected; | ||
} else { | ||
newFilter[filterField] = { | ||
[value]: isSelected, | ||
}; | ||
} |
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.
your call, but what about using ternary operator?
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.
I prefer to use ternary only in expressions
const treeUrl = | ||
'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'; |
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.
this should not be a const, it should change according to the tree you are in
@@ -15,9 +15,14 @@ export interface ITabItem { | |||
export interface ITabsComponent { | |||
tabs: ITabItem[]; | |||
defaultTab: ITabItem; | |||
FilterListElement?: JSX.Element; |
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.
nit: filterListElement
@@ -48,6 +53,8 @@ const TabsComponent = ({ defaultTab, tabs }: ITabsComponent): JSX.Element => { | |||
return ( | |||
<Tabs defaultValue={defaultTab.name} className="w-full"> | |||
<TabsList className="w-full justify-start">{tabsTrigger}</TabsList> | |||
<div className="py-6">{FilterListElement}</div> |
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.
I'm not sure it is worth it for us to pass the whole element instead of a list with the filters and call the necessary ui here
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.
In terms of processing, it's basically the same thing, we are passing a "reference" in both situations, but we gain more flexibility by passing an element here
4719c71
to
63e4ca3
Compare
- make onClickItemHandler pass the value to onClickItem - fix typo itens - fix color on hover on cleanAll button
- make the TreeDetails page own the filter instead of TreeDetailsFilter so we can pass the filter to other components like FilterList
- also add TreeUl as prop
63e4ca3
to
777bc55
Compare
Visual reference