-
Notifications
You must be signed in to change notification settings - Fork 2
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
enhance: add shadcn components and stories #120
Conversation
WalkthroughWalkthroughThis update enhances the design system by introducing new components and updating existing ones, improving modularity and usability. Key changes include the addition of aliases for easier imports, version upgrades for several dependencies, and the introduction of various UI components like Button, Calendar, and Popover. These changes aim to streamline development and improve the overall user experience across the design system. Changes
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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
Outside diff range, codebase verification and nitpick comments (3)
packages/design-system/src/ui/input.tsx (1)
1-3
: Consider adding a description for utility imports.The
cn
utility function is imported from@/lib/utils
. Ensure that this function is well-documented, as it plays a crucial role in managing class names.packages/design-system/src/ui/checkbox.tsx (1)
1-3
: Ensure Radix UI components are documented.The
Checkbox
component relies on Radix UI'sCheckboxPrimitive
. Ensure that the usage and customization of Radix UI components are well-documented for future reference.packages/design-system/src/ui/button.tsx (1)
56-56
: Consider separating constants or functions to a new file.Fast refresh only works when a file only exports components. Consider moving
buttonVariants
to a separate file to adhere to this best practice.Tools
GitHub Check: Lint
[warning] 56-56:
Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
Files selected for processing (17)
- packages/design-system/components.json (1 hunks)
- packages/design-system/package.json (1 hunks)
- packages/design-system/src/ui/accordion.stories.tsx (1 hunks)
- packages/design-system/src/ui/button.stories.tsx (1 hunks)
- packages/design-system/src/ui/button.tsx (1 hunks)
- packages/design-system/src/ui/calendar.stories.tsx (1 hunks)
- packages/design-system/src/ui/calendar.tsx (1 hunks)
- packages/design-system/src/ui/checkbox.stories.tsx (1 hunks)
- packages/design-system/src/ui/checkbox.tsx (1 hunks)
- packages/design-system/src/ui/input.stories.tsx (1 hunks)
- packages/design-system/src/ui/input.tsx (1 hunks)
- packages/design-system/src/ui/label.stories.tsx (1 hunks)
- packages/design-system/src/ui/label.tsx (1 hunks)
- packages/design-system/src/ui/navigation-menu.stories.tsx (1 hunks)
- packages/design-system/src/ui/navigation-menu.tsx (1 hunks)
- packages/design-system/src/ui/popover.stories.tsx (1 hunks)
- packages/design-system/src/ui/popover.tsx (1 hunks)
Files skipped from review due to trivial changes (4)
- packages/design-system/components.json
- packages/design-system/src/ui/checkbox.stories.tsx
- packages/design-system/src/ui/input.stories.tsx
- packages/design-system/src/ui/label.stories.tsx
Additional context used
GitHub Check: Lint
packages/design-system/src/ui/button.tsx
[warning] 56-56:
Fast refresh only works when a file only exports components. Use a new file to share constants or functions between componentspackages/design-system/src/ui/navigation-menu.tsx
[warning] 119-119:
Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
Additional comments not posted (26)
packages/design-system/src/ui/button.stories.tsx (1)
1-9
: LGTM!The setup for the Button story is clear and follows best practices for storybook components.
packages/design-system/src/ui/calendar.stories.tsx (1)
1-20
: LGTM!The Calendar story is well-implemented, demonstrating state management with React hooks effectively.
packages/design-system/src/ui/label.tsx (1)
1-24
: LGTM!The Label component is well-structured and uses
forwardRef
effectively. The styling approach withcva
andcn
is clean and maintainable.packages/design-system/src/ui/input.tsx (1)
8-22
: LGTM! Ensure consistent usage offorwardRef
.The
Input
component usesReact.forwardRef
, which is a good practice for allowing parent components to access the input's DOM node. Ensure this pattern is consistently applied across similar components for uniformity.packages/design-system/src/ui/accordion.stories.tsx (2)
8-12
: Ensure type compatibility with Storybook.The use of
satisfies StoryDefault
ensures type compatibility with Storybook's expectations. This is a good practice to prevent type-related issues.
14-32
: Enhance clarity with updated labels and content.The updated labels and content for the accordion items improve the clarity of the story. These changes align the component's presentation with its visual design and user experience.
packages/design-system/src/ui/checkbox.tsx (1)
7-25
: LGTM! Consistent use offorwardRef
and utility functions.The
Checkbox
component usesReact.forwardRef
and utility functions for class names, which is consistent with best practices for reusable components.packages/design-system/src/ui/popover.tsx (3)
6-6
: Export ofPopover
is straightforward and correct.The component is correctly exported as a direct alias for
PopoverPrimitive.Root
, maintaining simplicity and consistency.
8-8
: Export ofPopoverTrigger
is straightforward and correct.The component is correctly exported as a direct alias for
PopoverPrimitive.Trigger
, ensuring consistency with Radix UI's design.
10-27
:PopoverContent
component is well-implemented.The component uses
forwardRef
correctly, and the styling is handled through a utility function, ensuring flexibility and maintainability.packages/design-system/src/ui/button.tsx (2)
7-34
:buttonVariants
utility is well-structured.The utility provides a flexible and maintainable approach to styling buttons with different variants and sizes.
42-54
:Button
component is well-implemented.The component uses
forwardRef
andbuttonVariants
effectively, and theasChild
prop adds flexibility.packages/design-system/src/ui/popover.stories.tsx (1)
12-53
:Default
story forPopover
is well-constructed.The story provides a clear and comprehensive example of the Popover component's usage, demonstrating its integration with other design system components.
packages/design-system/src/ui/calendar.tsx (2)
10-60
: LGTM! Ensure accessibility compliance.The
Calendar
component implementation looks good. Ensure that the component is accessible, focusing on keyboard navigation and screen reader compatibility.
5-6
: Verify utility functions.Ensure that the utility functions
cn
andbuttonVariants
are robust and handle edge cases gracefully.Verification successful
Utility Functions Verified
The utility functions
cn
andbuttonVariants
are implemented robustly. Thecn
function effectively merges class names usingtwMerge
andclsx
, whilebuttonVariants
is a well-structured constant usingcva
for styling variants.
cn
is located inpackages/design-system/src/lib/utils.ts
.buttonVariants
is defined inpackages/design-system/src/ui/button.tsx
.These implementations ensure flexibility and maintainability in styling components.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the robustness of utility functions `cn` and `buttonVariants`. # Test: Search for the utility function implementations. Expect: Proper handling of edge cases. rg --type javascript --type typescript --pattern $'function cn' -A 5 rg --type javascript --type typescript --pattern $'function buttonVariants' -A 5Length of output: 975
Script:
#!/bin/bash # Description: Verify the robustness of utility functions `cn` and `buttonVariants`. # Test: Search for the utility function implementations. Expect: Proper handling of edge cases. rg 'function cn' --type javascript --type typescript -A 5 rg 'function buttonVariants' --type javascript --type typescript -A 5Length of output: 201
Script:
#!/bin/bash # Description: Verify the robustness of utility functions `cn` and `buttonVariants`. # Test: Search for the utility function implementations. Expect: Proper handling of edge cases. rg 'function cn' --type js --type ts -A 5 rg 'function buttonVariants' --type js --type ts -A 5Length of output: 298
Script:
#!/bin/bash # Description: Search for `buttonVariants` as a variable or import. # Test: Search for `buttonVariants` declaration or import. Expect: Find its definition or source. rg 'buttonVariants' --type js --type ts -A 5Length of output: 3143
packages/design-system/package.json (1)
11-29
: Verify compatibility of updated dependencies.Ensure that the updated and newly added dependencies are compatible with the existing codebase and do not introduce any breaking changes.
packages/design-system/src/ui/navigation-menu.stories.tsx (1)
1-140
: LGTM! Verify story configuration.The story for
NavigationMenu
is well-structured. Ensure that the configuration accurately reflects the intended use cases and that all components are correctly set up.packages/design-system/src/ui/navigation-menu.tsx (9)
26-39
: LGTM!The
NavigationMenuList
component is straightforward and uses Radix UI primitives effectively.
41-41
: LGTM!The
NavigationMenuItem
component is a simple re-export of the Radix UI primitive, which is appropriate.
43-45
: LGTM!The
navigationMenuTriggerStyle
definition is comprehensive and uses Tailwind CSS classes effectively.
65-78
: LGTM!The
NavigationMenuContent
component effectively uses animations and Radix UI primitives.
80-80
: LGTM!The
NavigationMenuLink
component is a simple re-export of the Radix UI primitive, which is appropriate.
47-63
: LGTM! VerifyChevronDown
icon behavior.The
NavigationMenuTrigger
component is well-implemented and uses Radix UI primitives effectively.However, ensure that the
ChevronDown
icon rotates correctly on state changes.Verification successful
ChevronDown Icon Behavior Verified
The
ChevronDown
icon in theNavigationMenuTrigger
component rotates correctly on state changes, as indicated by thegroup-data-[state=open]:rotate-180
class. No further issues were found.
- Location:
packages/design-system/src/ui/navigation-menu.tsx
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the behavior of the `ChevronDown` icon in `NavigationMenuTrigger`. # Test: Search for the `ChevronDown` icon usage. Expect: Correct rotation on state changes. rg --type javascript --type typescript -A 5 $'ChevronDown'Length of output: 92
Script:
#!/bin/bash # Description: Verify the behavior of the `ChevronDown` icon in `NavigationMenuTrigger`. # Corrected Test: Search for the `ChevronDown` icon usage. Expect: Correct rotation on state changes. rg --type js --type ts -A 5 'ChevronDown'Length of output: 4178
100-116
: LGTM! Verify indicator animations and positioning.The
NavigationMenuIndicator
component is well-implemented and uses Radix UI primitives effectively.However, ensure that the indicator's animations and positioning are correct.
82-98
: LGTM! Verify viewport positioning.The
NavigationMenuViewport
component is well-structured and uses Radix UI primitives effectively.However, ensure that the viewport is positioned correctly within the navigation menu.
8-23
: LGTM! Verifycn
utility function usage.The
NavigationMenu
component is well-structured and uses Radix UI primitives effectively.However, ensure that the
cn
utility function is correctly implemented to handle class name concatenation.Verification successful
The
cn
utility function is correctly implemented.The
cn
function usestwMerge
andclsx
to handle class name concatenation effectively. This ensures that Tailwind CSS classes are merged correctly and conditional class names are handled properly. No issues found with the implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the `cn` utility function. # Test: Search for the `cn` function implementation. Expect: Correct handling of class name concatenation. rg --type javascript --type typescript -A 5 $'function cn'Length of output: 94
Script:
#!/bin/bash # Description: Verify the implementation of the `cn` utility function. # Test: Search for the `cn` function implementation. Expect: Correct handling of class name concatenation. rg --type typescript --type typescriptreact -A 5 $'function cn'Length of output: 99
Script:
#!/bin/bash # Description: Locate and verify the implementation of the `cn` utility function. # Find all TypeScript and TSX files and search for the `cn` function. fd --extension ts --extension tsx --exec rg -A 5 $'function cn' {}Length of output: 148
export { | ||
navigationMenuTriggerStyle, | ||
NavigationMenu, | ||
NavigationMenuList, | ||
NavigationMenuItem, | ||
NavigationMenuContent, | ||
NavigationMenuTrigger, | ||
NavigationMenuLink, | ||
NavigationMenuIndicator, | ||
NavigationMenuViewport, | ||
} |
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.
Consider separating navigationMenuTriggerStyle
into a different file.
Fast refresh only works when a file only exports components. Consider moving navigationMenuTriggerStyle
to a separate file to adhere to best practices.
Tools
GitHub Check: Lint
[warning] 119-119:
Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
Summary by CodeRabbit
New Features
Updates
Documentation