-
Notifications
You must be signed in to change notification settings - Fork 47
feat(accordion): add custom icon support #97
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request introduces a new "Arrow style" feature for the Accordion component in the Flowbite Angular library. The changes include adding a new standalone Angular component Changes
Sequence DiagramsequenceDiagram
participant User
participant AccordionComponent
participant AccordionTitleComponent
participant IconComponent
User->>AccordionComponent: Interact with Accordion
AccordionComponent->>AccordionTitleComponent: Render Title
alt Custom Icon Defined
AccordionTitleComponent->>IconComponent: Render Custom Icon
else Default Icon
AccordionTitleComponent->>IconComponent: Render Chevron Icon
end
Possibly related PRs
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (4)
apps/docs/docs/components/accordion/index.md (1)
53-63
: Enhance documentation with feature description and usage guidelinesWhile the section follows the documentation structure, consider adding:
- A brief description of the arrow style feature
- Use cases or scenarios where custom icons would be beneficial
- Configuration options available for customization
Also, the TypeScript snippet range (L1-L7) seems limited and might not show the complete implementation.
Consider expanding the documentation like this:
## Arrow style + +The arrow style feature allows you to customize the appearance of accordion icons. This is useful when: +- You need to match your application's design system +- You want to use custom icons for expanded/collapsed states +- You need to modify the icon animation behavior + {{ NgDocActions.demo('flowbiteArrowStyleComponent', {container: false}) }} ```angular-html file="./_arrow-style.component.html" group="arrow-style" name="html"-
angular-ts file="./_arrow-style.component.ts"#L1-L7 group="arrow-style" name="typescript" +
angular-ts file="./_arrow-style.component.ts" group="arrow-style" name="typescript"apps/docs/docs/components/accordion/_arrow-style.component.html (2)
1-78
: Consider enhancing accessibility with ARIA labelsWhile the structure is semantically correct, consider adding ARIA labels to improve accessibility:
-<flowbite-accordion> +<flowbite-accordion aria-label="Flowbite FAQ"> <flowbite-accordion-panel [isOpen]="true"> - <flowbite-accordion-title [icon]="no_arrow">What is Flowbite ?</flowbite-accordion-title> + <flowbite-accordion-title [icon]="no_arrow" aria-level="2">What is Flowbite ?</flowbite-accordion-title>
80-85
: Add comments to document icon template usageConsider adding comments to explain the purpose of each template for better maintainability:
+<!-- Empty template to remove default chevron icon --> <ng-template #no_arrow /> +<!-- Custom question mark icon template --> <ng-template #question_mark_arrow> <flowbite-icon svgIcon="outline:question-circle" class="h-6 w-6 shrink-0" /> </ng-template>libs/flowbite-angular/accordion/accordion-title.component.ts (1)
33-36
: Add JSDoc comment to document the provider's purposeConsider adding documentation to explain the provider's role:
+/** + * Provides default value for accordion title icon. + * When undefined, the default chevron icon will be used. + */ { provide: FLOWBITE_ACCORDION_TITLE_ICON_DEFAULT_VALUE, useValue: undefined, },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/docs/docs/components/accordion/_arrow-style.component.html
(1 hunks)apps/docs/docs/components/accordion/_arrow-style.component.ts
(1 hunks)apps/docs/docs/components/accordion/index.md
(1 hunks)apps/docs/docs/components/accordion/ng-doc.page.ts
(2 hunks)libs/flowbite-angular/accordion/accordion-title.component.ts
(4 hunks)
🔇 Additional comments (4)
apps/docs/docs/components/accordion/_arrow-style.component.ts (1)
11-23
: Verify the empty component implementation
The component is correctly structured as a standalone component with proper imports. However, the empty class implementation suggests that all the logic might be in the template file.
Let's verify the template implementation:
✅ Verification successful
Empty component implementation is justified by template-driven functionality
The empty component class is appropriate as all the necessary functionality is handled through the template:
- The template implements a complete accordion structure with three panels
- Custom arrow styles are managed through template references (
#no_arrow
and#question_mark_arrow
) - The component properly demonstrates different arrow styles:
- First panel uses no arrow (
[icon]="no_arrow"
) - Second panel uses a question mark icon (
[icon]="question_mark_arrow"
) - Third panel uses default arrow (no icon binding)
- First panel uses no arrow (
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the template file exists and contains the necessary accordion structure
if [ -f "apps/docs/docs/components/accordion/_arrow-style.component.html" ]; then
echo "Template content:"
cat "apps/docs/docs/components/accordion/_arrow-style.component.html"
else
echo "Template file missing!"
fi
Length of output: 4020
apps/docs/docs/components/accordion/ng-doc.page.ts (1)
3-3
: LGTM! Component registration follows existing patterns
The arrow style demo component is properly imported and registered in the demos object, maintaining consistency with other demo components.
Also applies to: 25-25
libs/flowbite-angular/accordion/accordion-title.component.ts (2)
Line range hint 11-26
: LGTM! Clean implementation of the injection token
The injection token is well-defined with proper typing and follows naming conventions.
94-99
: LGTM! Well-documented icon property
The icon property is properly implemented using Angular's model() and includes clear documentation.
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Issue Number
Issue Number: #95
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Documentation