goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.36k stars 144 forks source link

feat(tabs): paginated tab list #206

Closed marcjulian closed 5 months ago

marcjulian commented 6 months ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Which package are you modifying?

What is the current behavior?

Closes #203

What is the new behavior?

Add hlm-paginated-tab-list component which handles pagination built on top of MatPaginatedTabHeader

CleanShot 2024-03-14 at 11 23 18

Current issues I am facing:

  1. Doesn't scroll on initial load to another tab Should find the position of the "Tab 20" and scroll it into view. CleanShot 2024-03-14 at 11 29 54

  2. Scroll position is calculated from tabs trigger, but the extra padding (p-1) on the list interferes with the correct scroll position When scrolling left with the keyboard it scrolls to "Tab 29" but does not consider the extra padding. The next paginator button is also still enabled, but should be disabled when it is at the end. CleanShot 2024-03-14 at 11 31 00 This is when it is scrolled all the way to the end. The next paginator is disabled and the padding around the tab is visible. CleanShot 2024-03-14 at 11 32 50

Does this PR introduce a breaking change?

Other information

marcjulian commented 6 months ago

@goetzrobin do you have an idea how to handle the extra padding around the tabs? I noticed when I add padding to the material tabs it behaves the same as with the current solution.

Not sure if we need to specify the padding amount to consider while scrolling.

goetzrobin commented 6 months ago

@goetzrobin do you have an idea how to handle the extra padding around the tabs? I noticed when I add padding to the material tabs it behaves the same as with the current solution.

Not sure if we need to specify the padding amount to consider while scrolling.

I think this is a tough one to figure out. I'd say as good as Angular Material is good enough for me. What do you think?

marcjulian commented 6 months ago

Yes think so too, will be tough to figure out the value. I am fine with the current limitation. I can add a note about it to the docs. I will add paginated tabs as a section to the tabs page.

marcjulian commented 6 months ago

@goetzrobin I polished the component styles and update the docs.

CleanShot 2024-04-04 at 12 21 33

goetzrobin commented 6 months ago

Cool that's awesome! Maybe we can make the docs more fun at a later date, but definitely not a blocker! This is great!

marcjulian commented 6 months ago

Good idea to improve the docs. Adding all inputs/outputs of a component could also be helpful.

goetzrobin commented 5 months ago

@marcjulian is this ready to go?

marcjulian commented 5 months ago

@goetzrobin yes is ready to go. I will solve the merge conflicts.