Closed danilo-moreira-brisa closed 7 months ago
The recent update involves a significant refactor of the IonChip
component to embrace styled-components
, enhancing its styling and structure. This transformation includes a revamp of testing setups, component structures, and style management, streamlining the usage of dynamic sizing and selected state colors, thereby elevating the component's adaptability and maintainability.
Files | Change Summary |
---|---|
src/components/chip/chip.test.tsx |
Adjusted imports and test utilities; switched to renderWithTheme ; updated assertions to use snapshots. |
src/components/chip/chip.tsx |
Reorganized imports; modified structure; updated props and rendering logic; removed and imported new style components. |
src/components/chip/styles.ts |
Refactored to use styled-components ; introduced dynamic sizing and handled selected states. |
src/stories/chip/chip.stories.tsx |
Reordered imports; updated argTypes definition format. |
IonChip
to use styled-components
, directly aligning with the objectives of this PR.styled-components
reflects a similar refactor direction as this PR, suggesting a broader initiative within the project.🐰✨
Changes abound, in code, we weave,
A tapestry of styles, we achieve.
With styled-components, we play,
Crafting chips, in a modern way.
Through fields of code, we hop,
Refactoring never stops.
🌟🐾
src/components/chip/chip.tsx (3)
`4-4`: Import statement correctly updated to use the `Chip` styled component. --- `6-6`: Export of `ChipSizes` type enhances type safety and code readability. --- `33-42`: Adjustments in the `IonChip` component correctly utilize the `Chip` styled component with dynamic props.src/stories/chip/chip.stories.tsx (2)
`1-1`: Reordering of imports improves readability and consistency. --- `7-9`: Update to the `argTypes` definition format correctly enhances storybook interactivity.src/components/chip/chip.test.tsx (2)
`3-3`: Import statement correctly updated to use `renderWithTheme` for better theme integration in tests. --- `44-49`: Update of test cases to use `toMatchSnapshot` promotes more reliable and maintainable tests.src/components/chip/styles.ts (1)
`79-129`: Refactoring to use styled-components, including dynamic sizing and handling selected state colors, is correctly implemented and enhances readability and maintainability.
Summary by CodeRabbit