-
Notifications
You must be signed in to change notification settings - Fork 129
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(pagination): add pagination #142
Conversation
I would like your feedback @goetzrobin on how we should implement previous/next. I added it as component but now I would need to handle passing Open tasks
|
Interesting question.... My mind went to thinking that you can just go with providing both as inputs (href & routerLink) and under the hood determine to use routerLink or href. Although if we pick one for now I'd go with routerLink as this is pretty much the default of how we link in Angular apps. |
Okay i added |
@marcjulian looking at your example now I think we should change it to router link and also add support for the additional router link option inputs. Your argument that this will most likely always be internal navigation makes sense! Sorry about the change of mind here! |
If I rename the input to The I see following options:
With approach 1. the user has full access to the anchor tag in the template, with 2. we would need to handle the additional router link options. |
@marcjulian Very good points. Maybe we stay with href or just do [link]="#" [linkOptions]="{ROUTER_OPTIONS_HERE}" ? I am open to hear your suggestion! We would also make routerlink a host directive for hlmPaginationLink and keep the same [link]="#" [linkOptions]="{ROUTER_OPTIONS_HERE}" inputs that are forwarded to routerlink? That way the API stays consitent? |
* rename routerLink to link as input
@goetzrobin the idea with I would prefer going with Which router link options do you mean should be exposed with For example @Directive({
selector: '[hlmPaginationLink]',
standalone: true,
hostDirectives: [
{
directive: RouterLink,
inputs: ['routerLink: link', 'queryParams', 'fragment' ...], // 👈
},
],
host: {
'[class]': '_computedClass()',
'[attr.aria-current]': 'isActive() ? "page" : null',
},
})
export class HlmPaginationLinkDirective { |
@marcjulian I'd say we keep all of them! Let's do link! I like it!! |
I run |
You probably need to adjust this part of the CLI: https://github.com/goetzrobin/spartan/blob/main/libs/cli/src/generators/base/lib/build-dependency-array.ts |
@goetzrobin I think I have found it. Please try it out and let me know what to do next. |
* feat(pagination): add pagination * feat(pagination): add href to previous/next and use routerLink for navigation * feat(pagination): update storybook * feat(pagination): use routerLink as host directive for paginationLink * rename routerLink to link as input * feat(pagination): expose all routerLink inputs for pagination link * feat(pagination): run hlm-to-cli generator * feat(pagination): add pagination on roadmap * feat(pagination): adds icon and button dependent * feat(pagination): add to pr and issue templates
PR Checklist
Please check if your PR fulfills the following requirements:
guidelines: https://github.com/goetzrobin/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines
PR Type
What kind of change does this PR introduce?
Which package are you modifying?
What is the current behavior?
Closes #119
What is the new behavior?
Does this PR introduce a breaking change?
Other information