-
Notifications
You must be signed in to change notification settings - Fork 0
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!: introducing Buttons size prop and refactor #81
feat!: introducing Buttons size prop and refactor #81
Conversation
WalkthroughThe changes across various files in the codebase revolve around the introduction of a new Changes
TipsChat with CodeRabbit Bot (
|
BundleMonFiles updated (2)
Unchanged files (1)
Total files change +172B +1.75% Final result: ✅ View report in BundleMon website ➡️ |
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.
Review Status
Actionable comments generated: 2
Configuration used: .coderabbit.yaml
Files selected for processing (11)
- packages/documentation/src/stories/Button.stories.tsx (3 hunks)
- packages/documentation/src/stories/ButtonIcon.stories.tsx (4 hunks)
- packages/documentation/src/stories/ButtonLink.stories.tsx (3 hunks)
- packages/ui-components/src/components/Button/Button.tsx (2 hunks)
- packages/ui-components/src/components/Button/ButtonIcon.tsx (2 hunks)
- packages/ui-components/src/components/Button/ButtonLink.tsx (2 hunks)
- packages/ui-components/src/components/Button/ButtonTypes.d.ts (2 hunks)
- packages/ui-components/src/components/Button/tests/Button.test.tsx (2 hunks)
- packages/ui-components/src/components/Button/tests/ButtonIcon.test.tsx (3 hunks)
- packages/ui-components/src/components/Button/tests/ButtonLink.test.tsx (5 hunks)
- packages/ui-components/src/components/Button/utilities.ts (2 hunks)
Additional comments: 30
packages/documentation/src/stories/Button.stories.tsx (3)
12-18:
The addition of thesize
property to theargs
object with a default value of "medium" aligns with the pull request summary and provides a sensible default for the Button component.32-41:
Thesize
property has been correctly added to theargTypes
object with the appropriate options and control type, ensuring that the Storybook interface will allow users to switch between different sizes for the Button component.57-63:
The update to theBasic
story's render function, adding the "flex-wrap" class to the wrapping div, is consistent with the pull request summary and ensures that the buttons will wrap correctly when not enough space is available.packages/documentation/src/stories/ButtonIcon.stories.tsx (3)
17-17:
The addition of thesize
property to theargs
object aligns with the pull request summary and is a necessary update for the new feature.44-45:
Thesize
property in theargTypes
object is correctly configured with the appropriate options and control type.58-58:
The use of<IconSettings />
here is acceptable as the summary indicates that only some instances have been replaced with<IconEdit />
.packages/documentation/src/stories/ButtonLink.stories.tsx (3)
14-17: The
size
property has been added to theargs
object with a default value of "small". This aligns with the summary stating thatButtonLink
components now have a "small" default size. This change should be cross-checked with the implementation in theui-components
package to ensure consistency.40-49: New properties
size
andmaxLabelLength
have been added to theargTypes
object. Thesize
property is correctly configured with radio buttons for "small", "medium", and "large", andmaxLabelLength
is controlled by a number input. This matches the summary description and provides the necessary Storybook controls for these new properties.57-67: The
render
function in theBasic
export has been updated. The wrapping div's class has been changed to "flex flex-wrap gap-2", and longer text content has been added to someButtonLink
components to demonstrate the newsize
property. This change is consistent with the summary and improves the visual demonstration of the components in the Storybook.packages/ui-components/src/components/Button/Button.tsx (2)
14-20:
The addition of thesize
property with a default value of "medium" is consistent with the summary and is properly integrated into the Button component's props.31-36:
Thesize
property is correctly passed to thegetButtonClasses
utility function, which has been refactored to handle it as per the summary.packages/ui-components/src/components/Button/ButtonIcon.tsx (2)
18-21:
The addition of thesize
property with a default value of "medium" is correctly implemented and follows the summary description.31-35:
Thesize
property is correctly passed to thegetButtonClasses
utility function. Ensure thatgetButtonClasses
is updated to handle this new property as described in the summary.packages/ui-components/src/components/Button/ButtonLink.tsx (2)
13-19:
The addition of thesize
parameter with a default value of "small" is correctly implemented and follows the summary description.32-37:
Thesize
parameter is correctly passed to thegetButtonClasses
utility function, ensuring that the button's class string will reflect the specified size.packages/ui-components/src/components/Button/ButtonTypes.d.ts (3)
11-18:
The addition of thesize
property toButtonProps
is consistent with the pull request summary and allows for size customization of buttons.20-28:
The addition of thesize
property toButtonLinkProps
aligns with the pull request summary, enabling size customization for link-styled buttons.30-35:
The inclusion of thesize
property inButtonIconProps
is in line with the pull request summary, facilitating size control for icon buttons.packages/ui-components/src/components/Button/__tests__/Button.test.tsx (3)
21-28:
The changes to the default button's classes align with the new size property implementation.37-43:
The renaming of the slim button test to indicate its legacy status and the adjustment of expected classes are appropriate.46-61:
The addition of tests for different button sizes ensures that the newsize
property is functioning as expected.packages/ui-components/src/components/Button/__tests__/ButtonIcon.test.tsx (3)
3-4:
The addition ofexpectToHaveClasses
is appropriate for the new tests that have been added.17-28:
The test has been correctly updated to reflect the new class expectations due to thesize
property changes.89-117:
The new tests for thesize
property are well-implemented and check for the correct classes corresponding to each size variant.packages/ui-components/src/components/Button/__tests__/ButtonLink.test.tsx (5)
3-3:
The addition of theexpectToHaveClasses
import is appropriate for the new tests that check for specific classes based on the size property.13-22: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [19-27]
Renaming the test to "should render a slim (legacy) anchor" is a good practice to indicate that this test is for a legacy feature, which may be deprecated in the future.
29-57:
The new tests for thesize
property are well-implemented and ensure that the correct classes are applied for each size variant.97-102:
The test for an anchor with truncated text correctly checks for the presence of an ellipsis, ensuring that themaxLabelLength
property functions as expected.109-114:
The test for an anchor with full text correctly checks for the entire label, ensuring that themaxLabelLength
property does not truncate text unnecessarily.packages/ui-components/src/components/Button/utilities.ts (1)
- 106-125:
The changes togetButtonClasses
correctly integrate the newsize
property with the existing class generation logic, ensuring that the correct classes are applied based on the button size.
Summary by CodeRabbit
New Features
size
property for buttons, allowing users to choose between "small", "medium", and "large" sizes across various button components.Enhancements
ButtonIcon
components for better visual representation.ButtonLink
components to support maximum label length customization and enhanced spacing in layouts.Documentation
size
property options for button components.Tests
size
property and class changes.