Skip to content
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

Added Error State for Timeline, SelectionCard Component #105

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

Swathi-eGov
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jul 30, 2024

Walkthrough

This update introduces a significant enhancement to the UI components library, focusing on adding error handling for key components like the "Timeline" and "SelectionCard." New styles and functionality have been implemented to improve layout, responsiveness, and user interaction, ensuring a more robust experience. The addition of stories for these components further aids in documentation and testing, making it easier for developers to visualize their usage.

Changes

File(s) Change Summary
react/css/CHANGELOG.md, react/ui-components/CHANGELOG.md Updated changelogs to include the addition of error states for "Timeline" and "SelectionCard" components in version 0.0.2-beta.15.
react/css/src/digitv2/components/*.scss Style modifications to enhance layout, responsiveness, and error states for action bar, selection card, and timeline components.
react/ui-components/src/atoms/SelectionCard.js Introduced a new SelectionCard component for selectable options with error handling and dynamic selection logic.
react/ui-components/src/atoms/Timeline.js Added a new isError prop to modify rendering based on error states.
react/ui-components/src/index.js Integrated the new SelectionCard component into the main export of the module.
react/ui-components/src/atoms/stories/*.stories.js Created storybook entries for SelectionCard and Timeline components, including scenarios for error states.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SelectionCard
    participant Timeline

    User->>SelectionCard: Select option
    SelectionCard->>User: Update selection state
    User->>Timeline: Check timeline status
    Timeline->>User: Display timeline with status
    alt Error State
        Timeline->>User: Show error message
    end
Loading

🐰 In a garden lush and wide,
New features hop and glide.
With error states, we now can see,
A timeline's tale, so clear and free.
Selection Card with joy to share,
For users everywhere! 🥕✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 85734bc and 6e463fe.

Files ignored due to path filters (7)
  • react/css/package.json is excluded by !**/*.json
  • react/example/package.json is excluded by !**/*.json
  • react/modules/Project/package.json is excluded by !**/*.json
  • react/modules/core/package.json is excluded by !**/*.json
  • react/modules/sample/package.json is excluded by !**/*.json
  • react/package.json is excluded by !**/*.json
  • react/ui-components/package.json is excluded by !**/*.json
Files selected for processing (18)
  • react/css/CHANGELOG.md (1 hunks)
  • react/css/src/digitv2/components/actionbarV2.scss (3 hunks)
  • react/css/src/digitv2/components/selectionCardV2.scss (1 hunks)
  • react/css/src/digitv2/components/sidebarV2.scss (11 hunks)
  • react/css/src/digitv2/components/timelineV2.scss (5 hunks)
  • react/css/src/digitv2/index.scss (1 hunks)
  • react/example/public/index.html (1 hunks)
  • react/ui-components/CHANGELOG.md (1 hunks)
  • react/ui-components/src/atoms/CheckBox.js (4 hunks)
  • react/ui-components/src/atoms/MobileSidebar.js (3 hunks)
  • react/ui-components/src/atoms/SelectionCard.js (1 hunks)
  • react/ui-components/src/atoms/Sidebar.js (2 hunks)
  • react/ui-components/src/atoms/Timeline.js (5 hunks)
  • react/ui-components/src/atoms/index.js (2 hunks)
  • react/ui-components/src/atoms/stories/SelectionCard.stories.js (1 hunks)
  • react/ui-components/src/atoms/stories/Timeline.stories.js (1 hunks)
  • react/ui-components/src/index.js (2 hunks)
  • react/ui-components/src/molecules/stories/TimelineMolecule.stories.js (1 hunks)
Files skipped from review due to trivial changes (4)
  • react/css/src/digitv2/components/sidebarV2.scss
  • react/css/src/digitv2/index.scss
  • react/example/public/index.html
  • react/ui-components/src/index.js
Additional context used
LanguageTool
react/css/CHANGELOG.md

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...og ## [0.0.2-beta.15] - 2024-07-30 ### Added - Added Error State for Timeline, SelectionCard...

(ENGLISH_WORD_REPEAT_RULE)

Additional comments not posted (50)
react/css/src/digitv2/components/selectionCardV2.scss (7)

1-5: LGTM!

The .selection-card-container rule correctly sets up the flex container with appropriate properties.


7-16: LGTM!

The .selection-card rule correctly applies flexbox properties, padding, border, and background color using theme variables.


18-20: LGTM!

The .selection-card.error rule correctly sets the border color for the error state using a theme variable.


22-51: LGTM!

The .option rule correctly applies various properties including padding, border, background color, and responsive font sizes using theme variables.


54-58: LGTM!

The .option.selected rule correctly sets the background color, text color, and font weight for the selected state using theme variables.


60-65: LGTM!

The .option .selectioncard-option-label rule correctly sets up the label within the option with flex properties.


68-72: LGTM!

The .option .selectioncardicon rule correctly sets up the icon within the option with flex properties.

react/ui-components/src/atoms/stories/SelectionCard.stories.js (4)

1-24: LGTM!

The default export correctly sets up the storybook configuration for the SelectionCard component with various controls and actions.


27-27: LGTM!

The Template component correctly renders the SelectionCard with the provided arguments.


29-39: LGTM!

The common arguments and options are correctly set up for the SelectionCard component.


41-99: LGTM!

The stories with different configurations for the SelectionCard component are correctly set up and follow standard practices.

react/css/CHANGELOG.md (1)

3-5: Fix the repeated word typo.

There is a possible typo due to word repetition in the changelog entry.

-  Added Error State for Timeline, SelectionCard Component
+  Added Error State for Timeline and SelectionCard Component

Likely invalid or redundant comment.

Tools
LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...og ## [0.0.2-beta.15] - 2024-07-30 ### Added - Added Error State for Timeline, SelectionCard...

(ENGLISH_WORD_REPEAT_RULE)

react/ui-components/src/atoms/CheckBox.js (4)

21-21: New prop hideLabel added.

The hideLabel prop is correctly added to the component's props.


39-39: Condition for displaying label before checkbox.

The condition (isLabelFirst && !hideLabel) is logically correct and ensures the label is displayed only when isLabelFirst is true and hideLabel is false.


74-74: Condition for displaying label after checkbox.

The condition (!isLabelFirst && !hideLabel) is logically correct and ensures the label is displayed only when isLabelFirst is false and hideLabel is false.


108-108: Prop type for hideLabel added.

The hideLabel prop type is correctly declared as a boolean.

react/ui-components/src/atoms/SelectionCard.js (7)

1-6: Necessary imports added.

The imports are necessary and correctly used within the component.


7-13: SelectionCard component defined.

The SelectionCard component and its props are correctly defined.


17-36: handleOptionClick function implemented.

The handleOptionClick function is correctly implemented to handle both single and multiple selections, updating the state and calling the onSelectionChanged callback.


38-62: IconRender function implemented.

The IconRender function is correctly implemented to dynamically import and render icons based on the iconReq and isActive parameters, with appropriate error handling.


64-87: renderOption function implemented.

The renderOption function is correctly implemented to render each option, applying the appropriate styles and handling clicks.


89-103: JSX structure implemented.

The JSX structure is correctly implemented, including the main container, options, and error message.


106-121: Prop types and default export implemented.

The prop types and default export are correctly defined.

react/css/src/digitv2/components/timelineV2.scss (5)

68-71: Styles for .upcoming class added.

The styles for the .upcoming class are correctly implemented, setting the text color to a secondary theme color.


Line range hint 116-126: Styles for .timeline-circle.inprogress:not(.error) class added.

The styles for the .timeline-circle.inprogress:not(.error) class are correctly implemented, applying specific styles when the circle is in progress and not in an error state.


Line range hint 131-144: Nested styles for .timeline-circle class added.

The nested styles for the .timeline-circle class, including styles for the .check-icon class, are correctly implemented.


146-148: Styles for .timeline-circle.completed class added.

The styles for the .timeline-circle.completed class are correctly implemented, setting the background color to a primary theme color.


179-206: Styles for .digit-timeline-item.error class added.

The styles for the .digit-timeline-item.error class are correctly implemented, applying distinct background colors and border styles for items marked as errors.

react/css/src/digitv2/components/actionbarV2.scss (6)

147-149: LGTM!

The .toRight class correctly applies margin-left: auto; to push the element to the right.


151-153: LGTM!

The .toLeft class correctly resets justify-content to its default value.


155-158: LGTM!

The .action-bar-individual-action-field class ensures buttons within this field flex to occupy equal space.


161-163: LGTM!

The conditional width ensures the element takes full width if it does not have the .toRight class.


176-176: LGTM!

The media query for small screens adjusts the gap, box-shadow, height, and padding for better responsiveness.


Line range hint 178-180:
LGTM!

The .action-bar-individual-action-field class within the media query ensures buttons take full width on small screens.

react/ui-components/src/atoms/Timeline.js (7)

21-21: LGTM!

The isError prop is correctly added to the component's prop list.


58-59: LGTM!

The defaultLabel correctly includes a condition to show "Failed!" when isError is true.


71-71: LGTM!

The main container's class name is correctly updated to include an "error" class when isError is true.


72-72: LGTM!

The timeline circle's class name is correctly updated to include an "error" class when isError is true.


73-81: LGTM!

The check icon for completed steps is correctly rendered only when there is no error.


82-90: LGTM!

The error icon is correctly rendered when isError is true.


117-117: LGTM!

The timeline date correctly shows "Incomplete" instead of "date" when isError is true.

react/ui-components/CHANGELOG.md (1)

7-9: LGTM!

The new changelog entry correctly highlights the addition of an "Error State" for the "Timeline" and "SelectionCard" components.

react/ui-components/src/atoms/stories/Timeline.stories.js (1)

218-226: LGTM! The new ErrorTimeline export is well-defined.

The addition of the ErrorTimeline export enhances the component by providing an error state configuration.

react/ui-components/src/atoms/Sidebar.js (2)

80-80: LGTM! The dynamic adjustment of the fill property enhances visual adaptability.

The use of the theme prop to dynamically adjust the fill property of the SVG.Search component improves the component's responsiveness to different themes.


109-109: LGTM! The enhanced logic for displaying icons is well-implemented.

The additional condition to check if the current item is a parent of the selected item ensures a more nuanced representation of item selection.

react/ui-components/src/atoms/MobileSidebar.js (2)

15-16: LGTM! The addition of the ref prop enhances the component's flexibility.

The ref prop allows parent components to directly reference the sidebar DOM element, which can be useful for various interactions.

Also applies to: 204-204


93-97: LGTM! The adjustments in the rendering logic improve readability.

The use of parentheses around the conditional expression for rendering icons is standardized, enhancing readability without altering the underlying logic.

Also applies to: 100-100

react/ui-components/src/atoms/index.js (2)

87-87: Import statement for SelectionCard looks good.

The import path and naming convention follow the project's standards.


275-275: Export statement for SelectionCard looks good.

The export statement is correctly formatted and follows the project's standards.

react/ui-components/src/molecules/stories/TimelineMolecule.stories.js (1)

318-351: WithError story looks good.

The story correctly demonstrates the error state for the Timeline component using the isError prop. The overall structure and usage are appropriate.

@jagankumar-egov jagankumar-egov merged commit 88a40d5 into develop Jul 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants