Closed danilo-moreira-brisa closed 5 months ago
The recent updates enhance the IonBadge
component, introducing new properties and styles to support dot badges with icons and custom colors. New test cases and storybook stories ensure the component's functionality and appearance are well-documented and easily adjustable through UI controls.
Files | Change Summary |
---|---|
.../badge/badge.test.tsx |
Added getDotBadge function, updated test descriptions and assertions, new test cases for dot badges. |
.../badge/badge.tsx |
Enhanced IonBadge with new props (dot , icon , size , status , customColor ). Added new types. |
.../badge/styles.ts |
Added DotStylesProps , DotContainer , and Dot styled components. Updated imports and types. |
.../badge/badge.stories.tsx |
Updated storybook title, added control parameters for 'label' and 'type'. |
.../badge/dotBadge.stories.tsx |
New story for dot badge variations (dot-only, with icon, with custom color). |
🐇✨ In the land of code, where the bits align, A badge was born, oh so fine! With dots and icons, colors so bright, A rabbit hopped with sheer delight. Celebrate the badge, a new design in sight! 🎉 🐇✨
src/stories/badge/badge.stories.tsx (2)
`6-6`: Updated the storybook title to better categorize the badge types. --- `8-10`: Added new parameters for controls to allow interactive customization and testing within the storybook environment.src/components/badge/badge.tsx (5)
`9-14`: Introduced new `BadgeStatus` type to support different statuses like 'negative', 'positive', 'warning', and 'info'. --- `16-16`: Added `BadgeDotSizes` type to define available sizes for the dot badge. --- `19-25`: Updated `BadgeProps` to include new properties for the dot badge feature, enhancing the component's versatility. --- `28-32`: Defined `ICON_SIZE` mapping to associate dot sizes with numerical values, facilitating styling adjustments. --- `36-71`: Enhanced the `IonBadge` component to conditionally render a dot badge with optional icon and custom color. Ensure thorough testing of all conditional branches.src/components/badge/styles.ts (3)
`8-13`: Introduced `DotStylesProps` to handle styling based on the dot badge's size, status, and other properties. --- `67-77`: Added `DotContainer` styled component to manage layout and styling of the dot badge container. --- `79-91`: Added `Dot` styled component to apply specific styles to the dot badge based on its properties. Ensure that the fallback color matches the intended design specifications.src/components/badge/badge.test.tsx (4)
`21-23`: Added `getDotBadge` function to facilitate testing of the dot badge feature. --- `95-104`: Added test cases to verify the default rendering of the dot badge. Ensure that all style rules are correctly applied. --- `108-112`: Added test case to verify the rendering of the dot badge with a label. Ensure label visibility and correctness. --- `116-134`: Added test cases to verify the conditional rendering of icons in dot badges based on size. Ensure that icons are rendered correctly for sizes greater than 'xs' and not rendered for 'xs'.
Summary by CodeRabbit
New Features
IonBadge
component with new properties for dot display, icons, custom colors, and badge statuses.Tests
Documentation
Style
Dot
component and its container.