Skip to content
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

Visually differentiate sort components from filter components #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

piedpiper358
Copy link
Contributor

@piedpiper358 piedpiper358 commented Sep 6, 2022

Before:

2022-09-06_21-10-00

After:

2022-09-06_20-16-50

Before:

2022-09-06_21-14-11

After:

2022-09-06_20-16-05

Before:

2022-09-06_21-10-50

After:

2022-09-06_20-15-47

Before:

2022-09-06_21-11-12

After:

2022-09-06_21-24-04

@sebastientromp
Copy link
Contributor

The result looks really good.
I would keep using a single component (you can still keep the "filter-dropdown" name) with an isSort flag, as both are essentially the same. That would reduce the amount of duplicated code

@piedpiper358
Copy link
Contributor Author

I would keep using a single component with an isSort flag

I probably won't be able to work that hard on the project anytime soon, as I need to work a little at another job to earn some money) But I will do it when I have free time.

@sebastientromp
Copy link
Contributor

That's awesome! Congrats for landing the new job :)

@piedpiper358
Copy link
Contributor Author

@sebastientromp, I still feel like the sort components should be a separate component as they have different user interaction logic and perhaps in the future we may want to further differentiate sort components from filter components. For example, we may want to implement sorting in descending or ascending order, etc. While using the isSort flag in the filtering component looks like a crutch.

@piedpiper358 piedpiper358 removed their assignment Nov 13, 2022
@sebastientromp
Copy link
Contributor

Yes, I agree that having different components make more sense.
However I'm not totally comfortable with the amount of duplicate code there is between the components.
It might be ok though, since the logic inside these components almost never change.

Let me think about it for a bit.


@Component({
selector: 'sort-dropdown',
styleUrls: [`../../css/global/scrollbar.scss`, `../../css/component/sort-dropdown.component.scss`],
Copy link
Contributor

Choose a reason for hiding this comment

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

Here I would reference the .scss of the filter-dropdown component, and use a new file only for the style that is specific to that new component. This would make it easier to understand the differences between the two

`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SortDropdownComponent implements AfterViewInit {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here I would use an abstract, parent component that contains the shared code, and use subclasses to redefine the behavior where appropriate.
The "filter" and "sort" functions are IMO intrinsically very similar, and I don't see them diverging a lot in the future. And if they do, it will most likely be through the options they propose, or how option selection is handled. This means that all the layout is probably best handled in a common way.

Would you like me to do it? Or would you like to give it a try?

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.

2 participants