-
Notifications
You must be signed in to change notification settings - Fork 0
IBX-10758: Overflow list #54
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
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.
Pull Request Overview
This PR implements an overflow list component for the Ibexa design system that automatically manages the display of list items based on available container width. When items exceed the container width, they are hidden and a "more" indicator shows the count of hidden items.
- Adds a new OverflowList Twig component with validation and template generation
- Implements TypeScript functionality for dynamic item hiding/showing based on container resize
- Updates ESLint configuration to allow specific magic numbers used in the overflow logic
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/Twig/Components/OverflowList.php | New Twig component class with props validation and template property generation |
| src/bundle/Resources/views/themes/standard/design_system/components/overflow_list.html.twig | Twig template for rendering the overflow list with item and "more" templates |
| src/bundle/Resources/public/ts/init_components.ts | Component initialization registration for overflow list instances |
| src/bundle/Resources/public/ts/components/oveflow_list.ts | Main TypeScript implementation with resize handling and item visibility management |
| eslint.config.mjs | ESLint configuration update to allow specific magic numbers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
09b0932 to
145c418
Compare
1cefefd to
6d7a86e
Compare
6c73782 to
e3d6e0a
Compare
| item: this.getTemplate('item'), | ||
| itemMore: this.getTemplate('item_more'), | ||
| }; | ||
|
|
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.
| private getItems(getOnlyVisible = false, withOverflow = true): HTMLDivElement[] { | ||
| const itemsSelector = `:scope > *${getOnlyVisible ? ':not([hidden])' : ''}`; | ||
| const items = Array.from(this._itemsNode.querySelectorAll<HTMLDivElement>(itemsSelector)); | ||
|
|
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.
Nitpick: WDYT about changing to this? then no need to create an additional string, and it looks a bit more readable.
let items = [];
if(getOnlyVisible) {
items = Array.from(this._itemsNode.querySelectorAll(':scope > *:not([hidden])'))
} else {
items = Array.from(this._itemsNode.children);
}
| } | ||
|
|
||
| public rerender() { | ||
| let stopRecalculating = true; |
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.
| let stopRecalculating = true; | |
| let stopRecalculating = true; | |
| item: '', | ||
| itemMore: '', | ||
| }; | ||
|
|
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.
|
|
||
| if (hiddenCount > 0) { | ||
| const tempMoreItem = document.createElement('div'); | ||
| tempMoreItem.innerHTML = this._templates.itemMore.replace('{{ hidden_count }}', hiddenCount.toString()); |
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.
| tempMoreItem.innerHTML = this._templates.itemMore.replace('{{ hidden_count }}', hiddenCount.toString()); | |
| tempMoreItem.innerHTML = this._templates.itemMore.replace('{{ hidden_count }}', hiddenCount.toString()); |
Related PRs:
Description:
For QA:
Documentation: