Closed danilo-moreira-brisa closed 6 months ago
This update introduces a new loading
prop across the Button component in a React project, enabling the display of a loading spinner. The changes span across component logic, tests, styles, and storybook entries to ensure a comprehensive implementation and visualization of the loading state in buttons.
Files | Changes Summary |
---|---|
src/components/button/button.test.tsx |
Added tests for loading spinner in various states. |
src/components/button/button.tsx |
Introduced loading prop, updated component logic to handle spinner. |
src/components/button/styles.ts |
Updated styles to include loading state colors and properties. |
src/stories/button/button.stories.tsx |
Added storybook entry to visualize the loading state. |
🐇💻✨
In the meadow of code, under the sky so wide,
A new feature hops in, with a spinner at its side.
Click me not, for I'm busy, spinning dots so bright,
A button now resting, in its loading plight.
🔄🔘🐰
src/components/button/button.tsx (4)
`20-20`: The addition of the `loading` property to `ButtonProps` is well-implemented and aligns with the PR's objectives to enable a loading state for the button. --- `23-28`: The `ICON_SIZE` constant is well-defined for different button sizes. This ensures consistency in the spinner size across different button sizes. --- Line range hint `38-64`: The conditional rendering of the spinner or icon based on the `loading` state is correctly implemented. Ensure that the `IonSpinner` and `IonIcon` components are tested for their behavior when the `loading` prop changes. --- `57-57`: The `$loading` style prop is correctly passed to the styled `Button` component, allowing for style adjustments based on the loading state.src/components/button/styles.ts (5)
`13-13`: The addition of the `$loading` property to `ButtonStylesProps` is correctly implemented, allowing for conditional styling based on the loading state. --- `27-27`: The `loading` state has been correctly added to `ColorDefinitions`, enabling specific color definitions for the loading state. --- `94-96`: The loading color definitions for the `primary` variant are well-defined, ensuring visual consistency when the button is in a loading state. --- `119-123`: The loading color definitions for the `secondary` variant are correctly specified, providing clear visual cues for the loading state. --- Line range hint `233-258`: The conditional styling based on the `$loading` property is well-implemented, ensuring that the button's appearance is appropriately adjusted when in a loading state.
Summary by CodeRabbit
loading
property.